Commit 87e0b575 authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Sasha Levin

KVM: x86: mask CPUID(0xD,0x1).EAX against host value

[ Upstream commit 316314ca ]

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: default avatarRadim Krčmář <rkrcmar@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 4b6986fc
...@@ -501,6 +501,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, ...@@ -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); do_cpuid_1_ent(&entry[i], function, idx);
if (idx == 1) { if (idx == 1) {
entry[i].eax &= kvm_supported_word10_x86_features; entry[i].eax &= kvm_supported_word10_x86_features;
cpuid_mask(&entry[i].eax, 10);
entry[i].ebx = 0; entry[i].ebx = 0;
if (entry[i].eax & (F(XSAVES)|F(XSAVEC))) if (entry[i].eax & (F(XSAVES)|F(XSAVEC)))
entry[i].ebx = entry[i].ebx =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment