]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: never trap MSR_KERNEL_GS_BASE
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 24 Sep 2018 15:23:01 +0000 (17:23 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 24 Sep 2018 16:34:13 +0000 (18:34 +0200)
commit244a0bf6d634b1c0720811081f6b053c3ff06e83
treea4d50f6a3e19a684d9d4c01fa0834e2e4aec92a9
parent3214d873dcbece560eba3e0acfa98fcd4d8c6b7f
KVM: x86: never trap MSR_KERNEL_GS_BASE

KVM has an old optimization whereby accesses to the kernel GS base MSR
are trapped when the guest is in 32-bit and not when it is in 64-bit mode.
The idea is that swapgs is not available in 32-bit mode, thus the
guest has no reason to access the MSR unless in 64-bit mode and
32-bit applications need not pay the price of switching the kernel GS
base between the host and the guest values.

However, this optimization adds complexity to the code for little
benefit (these days most guests are going to be 64-bit anyway) and in fact
broke after commit 446f22d993be ("KVM: vmx: add dedicated utility to
access guest's kernel_gs_base", 2018-08-06); the guest kernel GS base
can be corrupted across SMIs and UEFI Secure Boot is therefore broken
(a secure boot Linux guest, for example, fails to reach the login prompt
about half the time).  This patch just removes the optimization; the
kernel GS base MSR is now never trapped by KVM, similarly to the FS and
GS base MSRs.

Fixes: 446f22d993be90bb769856e6707d5aa8fdc214bd
Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c