summaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2019-12-20 20:45:10 -0800
committerBorislav Petkov <bp@suse.de>2020-01-13 19:26:58 +0100
commitff10e22e65f2b4d5d09805dd9e7194b93e303eb1 (patch)
tree2cf6e974f2ef3c5209263052a5f9c4f733d41464 /arch/x86
parenta4d0b2fdbcf75ef6654713c83c316ea3a661ddc3 (diff)
downloadlinux-stable-ff10e22e65f2b4d5d09805dd9e7194b93e303eb1.tar.gz
linux-stable-ff10e22e65f2b4d5d09805dd9e7194b93e303eb1.tar.bz2
linux-stable-ff10e22e65f2b4d5d09805dd9e7194b93e303eb1.zip
KVM: VMX: Check for full VMX support when verifying CPU compatibility
Explicitly check the current CPU's IA32_FEAT_CTL and VMX feature flags when verifying compatibility across physical CPUs. This effectively adds a check on IA32_FEAT_CTL to ensure that VMX is fully enabled on all CPUs. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20191221044513.21680-17-sean.j.christopherson@intel.com
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/vmx/vmx.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 06e0e5262704..cdb4bf50ee14 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6838,6 +6838,12 @@ static int __init vmx_check_processor_compat(void)
struct vmcs_config vmcs_conf;
struct vmx_capability vmx_cap;
+ if (!this_cpu_has(X86_FEATURE_MSR_IA32_FEAT_CTL) ||
+ !this_cpu_has(X86_FEATURE_VMX)) {
+ pr_err("kvm: VMX is disabled on CPU %d\n", smp_processor_id());
+ return -EIO;
+ }
+
if (setup_vmcs_config(&vmcs_conf, &vmx_cap) < 0)
return -EIO;
if (nested)