Skip to content

Commit 85c9aae

Browse files
jsmattsonjrbonzini
authored andcommitted
kvm: nVMX: Relax guest IA32_FEATURE_CONTROL constraints
Commit 37e4c99 ("KVM: VMX: validate individual bits of guest MSR_IA32_FEATURE_CONTROL") broke the KVM_SET_MSRS ABI by instituting new constraints on the data values that kvm would accept for the guest MSR, IA32_FEATURE_CONTROL. Perhaps these constraints should have been opt-in via a new KVM capability, but they were applied indiscriminately, breaking at least one existing hypervisor. Relax the constraints to allow either or both of FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX and FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX to be set when nVMX is enabled. This change is sufficient to fix the aforementioned breakage. Fixes: 37e4c99 ("KVM: VMX: validate individual bits of guest MSR_IA32_FEATURE_CONTROL") Signed-off-by: Jim Mattson <[email protected]> Reviewed-by: Liran Alon <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent ad5996d commit 85c9aae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/x86/kvm/vmx/vmx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7115,10 +7115,12 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
71157115

71167116
if (nested_vmx_allowed(vcpu))
71177117
to_vmx(vcpu)->msr_ia32_feature_control_valid_bits |=
7118+
FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX |
71187119
FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX;
71197120
else
71207121
to_vmx(vcpu)->msr_ia32_feature_control_valid_bits &=
7121-
~FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX;
7122+
~(FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX |
7123+
FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX);
71227124

71237125
if (nested_vmx_allowed(vcpu)) {
71247126
nested_vmx_cr_fixed1_bits_update(vcpu);

0 commit comments

Comments
 (0)