]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: reinstate vendor-agnostic check on SPEC_CTRL cpuid bits
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 3 Dec 2020 14:40:15 +0000 (09:40 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 12 Dec 2020 00:05:13 +0000 (19:05 -0500)
commit16ab7065f58ae93cc7042afc568a2010f9451d36
treeee70878bda9d73a2efa0b8c6bc6b12cd7f6cf77e
parent1b98c6daa0f2a90c764372f6090a66ef856c81f6
KVM: x86: reinstate vendor-agnostic check on SPEC_CTRL cpuid bits

Until commit 27fb2630bbee ("x86/speculation: Use synthetic bits for
IBRS/IBPB/STIBP"), KVM was testing both Intel and AMD CPUID bits before
allowing the guest to write MSR_IA32_SPEC_CTRL and MSR_IA32_PRED_CMD.
Testing only Intel bits on VMX processors, or only AMD bits on SVM
processors, fails if the guests are created with the "opposite" vendor
as the host.

While at it, also tweak the host CPU check to use the vendor-agnostic
feature bit X86_FEATURE_IBPB, since we only care about the availability
of the MSR on the host here and not about specific CPUID bits.

Fixes: 27fb2630bbee ("x86/speculation: Use synthetic bits for IBRS/IBPB/STIBP")
Cc: stable@vger.kernel.org
Reported-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.h
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/vmx.c