Commit 039f0813ad4ed196883d87a6643041ae413dfde0

Authored by Paolo Bonzini
Committed by Greg Kroah-Hartman
1 parent a6fa60f561

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>

Showing 1 changed file with 1 additions and 0 deletions Side-by-side Diff

arch/x86/kvm/cpuid.c
... ... @@ -509,6 +509,7 @@
509 509 do_cpuid_1_ent(&entry[i], function, idx);
510 510 if (idx == 1) {
511 511 entry[i].eax &= kvm_supported_word10_x86_features;
  512 + cpuid_mask(&entry[i].eax, 10);
512 513 entry[i].ebx = 0;
513 514 if (entry[i].eax & (F(XSAVES)|F(XSAVEC)))
514 515 entry[i].ebx =