]> 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)
commitdc1769523f69108fe03a6a163e4af7cca637bdc6
treeee70878bda9d73a2efa0b8c6bc6b12cd7f6cf77e
parent6540b2e110e3a7bc363e9071b19e4fc2869b9f0b
KVM: x86: reinstate vendor-agnostic check on SPEC_CTRL cpuid bits

Until commit 675d24fc6b33 ("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: 675d24fc6b33 ("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