summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-03-21 12:33:00 +0100
committerSasha Levin <sasha.levin@oracle.com>2016-07-10 23:07:27 -0400
commit87e0b5757eab598f4b55babdc8879e143a556b7a (patch)
treea735c892c02e0a255691fd2cf267bc99719d2192
parent4b6986fcceb200b2edd97d7cc5799d8a7ae53086 (diff)
KVM: x86: mask CPUID(0xD,0x1).EAX against host value
[ Upstream commit 316314cae15fb0e3869b76b468f59a0c83ac3d4e ] 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> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-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 1d08ad3582d0..090aa5c1d6b1 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -501,6 +501,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 =