diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-03-21 07:33:00 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-04-10 15:53:50 -0400 |
commit | 316314cae15fb0e3869b76b468f59a0c83ac3d4e (patch) | |
tree | 7ee2d450b5d8972971d17542410890d8559e7a05 | |
parent | fc5b7f3bf1e1414bd4e91db6918c85ace0c873a5 (diff) |
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>
-rw-r--r-- | arch/x86/kvm/cpuid.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 8efb839948e5..bbbaa802d13e 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c | |||
@@ -534,6 +534,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, | |||
534 | do_cpuid_1_ent(&entry[i], function, idx); | 534 | do_cpuid_1_ent(&entry[i], function, idx); |
535 | if (idx == 1) { | 535 | if (idx == 1) { |
536 | entry[i].eax &= kvm_cpuid_D_1_eax_x86_features; | 536 | entry[i].eax &= kvm_cpuid_D_1_eax_x86_features; |
537 | cpuid_mask(&entry[i].eax, CPUID_D_1_EAX); | ||
537 | entry[i].ebx = 0; | 538 | entry[i].ebx = 0; |
538 | if (entry[i].eax & (F(XSAVES)|F(XSAVEC))) | 539 | if (entry[i].eax & (F(XSAVES)|F(XSAVEC))) |
539 | entry[i].ebx = | 540 | entry[i].ebx = |