summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-03-21 12:33:00 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-01 12:17:01 -0700
commitcaa2ca520f0d0cb963f5d0a18cbcd7cdfd1f1b0d (patch)
treec835420676f258c5ed19395e839071659f34c160
parentf9c9ade6b859d50a4b186ac45793fa0d0e7698e9 (diff)
downloadlwn-caa2ca520f0d0cb963f5d0a18cbcd7cdfd1f1b0d.tar.gz
lwn-caa2ca520f0d0cb963f5d0a18cbcd7cdfd1f1b0d.zip
KVM: x86: mask CPUID(0xD,0x1).EAX against host value
commit 316314cae15fb0e3869b76b468f59a0c83ac3d4e upstream. This ensures that the guest doesn't see XSAVE extensions (e.g. xgetbv1 or xsavec) that the host lacks. Cc: stable@vger.kernel.org Reviewed-by: Radim Krčmář <rkrcmar@redhat.com> [4.5 does have CPUID_D_1_EAX, but earlier kernels don't, so use the numeric value. This is consistent with other occurrences of cpuid_mask in arch/x86/kvm/cpuid.c - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/x86/kvm/cpuid.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 6525e926f566..2e1fd586b895 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -509,6 +509,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
do_cpuid_1_ent(&entry[i], function, idx);
if (idx == 1) {
entry[i].eax &= kvm_supported_word10_x86_features;
+ cpuid_mask(&entry[i].eax, 10);
entry[i].ebx = 0;
if (entry[i].eax & (F(XSAVES)|F(XSAVEC)))
entry[i].ebx =