KVM: x86: mask CPUID(0xD,0x1).EAX against host value
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 21 Mar 2016 11:33:00 +0000 (12:33 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 10 Apr 2016 19:53:50 +0000 (21:53 +0200)
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>
arch/x86/kvm/cpuid.c

index 8efb839948e512e9aac6aaf544230195614297c1..bbbaa802d13efc8b1e57f7defa351cacb2aaab78 100644 (file)
@@ -534,6 +534,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_cpuid_D_1_eax_x86_features;
+                               cpuid_mask(&entry[i].eax, CPUID_D_1_EAX);
                                entry[i].ebx = 0;
                                if (entry[i].eax & (F(XSAVES)|F(XSAVEC)))
                                        entry[i].ebx =