Skip to content

Commit ff10e22

Browse files
Sean Christophersonsuryasaimadhu
authored andcommitted
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 <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent a4d0b2f commit ff10e22

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/x86/kvm/vmx/vmx.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6838,6 +6838,12 @@ static int __init vmx_check_processor_compat(void)
68386838
struct vmcs_config vmcs_conf;
68396839
struct vmx_capability vmx_cap;
68406840

6841+
if (!this_cpu_has(X86_FEATURE_MSR_IA32_FEAT_CTL) ||
6842+
!this_cpu_has(X86_FEATURE_VMX)) {
6843+
pr_err("kvm: VMX is disabled on CPU %d\n", smp_processor_id());
6844+
return -EIO;
6845+
}
6846+
68416847
if (setup_vmcs_config(&vmcs_conf, &vmx_cap) < 0)
68426848
return -EIO;
68436849
if (nested)

0 commit comments

Comments
 (0)