KVM: VMX: Fix host userspace gsbase corruption
authorAvi Kivity <avi@redhat.com>
Thu, 11 Nov 2010 10:37:26 +0000 (12:37 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 9 Dec 2010 21:32:45 +0000 (13:32 -0800)
commit917aa3c5da5215de1ebe72d4ef2f84ef116c5ff8
tree9aef01b800bece7560730c2d37a01681f2cf471a
parenta700b4efaa3451c9fe0ddfb57c9024e8ad767c47
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kvm/vmx.c