OSDN Git Service

KVM: x86: disable MPX if host did not enable MPX XSAVE features
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 8 Mar 2016 08:52:13 +0000 (09:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Jul 2017 05:44:59 +0000 (07:44 +0200)
commitc6f3576ed0f21058629d5461eb014c1e0e3f7c4d
tree9cd574afe509859a9b5ebb24f93d3878f993b24b
parent999b96b4de81a984bc94302b9ab7cad9f45eb6df
KVM: x86: disable MPX if host did not enable MPX XSAVE features

commit a87036add09283e6c4f4103a15c596c67b86ab86 upstream.

When eager FPU is disabled, KVM will still see the MPX bit in CPUID and
presumably the MPX vmentry and vmexit controls.  However, it will not
be able to expose the MPX XSAVE features to the guest, because the guest's
accessible XSAVE features are always a subset of host_xcr0.

In this case, we should disable the MPX CPUID bit, the BNDCFGS MSR,
and the MPX vmentry and vmexit controls for nested virtualization.
It is then unnecessary to enable guest eager FPU if the guest has the
MPX CPUID bit set.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/cpuid.c
arch/x86/kvm/cpuid.h
arch/x86/kvm/vmx.c