Skip to content

Commit 316314c

Browse files
committed
KVM: x86: mask CPUID(0xD,0x1).EAX against host value
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>
1 parent fc5b7f3 commit 316314c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/x86/kvm/cpuid.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
534534
do_cpuid_1_ent(&entry[i], function, idx);
535535
if (idx == 1) {
536536
entry[i].eax &= kvm_cpuid_D_1_eax_x86_features;
537+
cpuid_mask(&entry[i].eax, CPUID_D_1_EAX);
537538
entry[i].ebx = 0;
538539
if (entry[i].eax & (F(XSAVES)|F(XSAVEC)))
539540
entry[i].ebx =

0 commit comments

Comments
 (0)