KVM: VMX: Fix host userspace gsbase corruption
authorBen Hutchings <ben@decadent.org.uk>
Mon, 29 Nov 2010 15:00:15 +0000 (13:00 -0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 9 Dec 2010 21:26:48 +0000 (13:26 -0800)
commitfda45f0be5c9d1671b6bc5b35b6143360f2b10bd
tree77c18fad57a70651c7ec6e7b43c88e648523107d
parent91445a8f6fee2f78680bae847cabe237a6e57eb9
KVM: VMX: Fix host userspace gsbase corruption

commit c8770e7ba63bb5dd8fe5f9d251275a8fa717fb78 upstream.

We now use load_gs_index() to load gs safely; unfortunately this also
changes MSR_KERNEL_GS_BASE, which we managed separately.  This resulted
in confusion and breakage running 32-bit host userspace on a 64-bit kernel.

Fix by
- saving guest MSR_KERNEL_GS_BASE before we we reload the host's gs
- doing the host save/load unconditionally, instead of only when in guest
  long mode

Things can be cleaned up further, but this is the minmal fix for now.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
[bwh: Backport to 2.6.32]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kvm/vmx.c