]> git.itanic.dy.fi Git - linux-stable/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)
commit39485ed95d6b83b62fa75c06c2c4d33992e0d971
treeee70878bda9d73a2efa0b8c6bc6b12cd7f6cf77e
parent2224fc9efb2d6593fbfb57287e39ba4958b188ba
KVM: x86: reinstate vendor-agnostic check on SPEC_CTRL cpuid bits

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