Skip to content

Commit 2768c0c

Browse files
Sean Christophersonbonzini
authored andcommitted
KVM: nVMX: WARN if nested run hits VMFail with early consistency checks enabled
When early consistency checks are enabled, all VMFail conditions should be caught by nested_vmx_check_vmentry_hw(). Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 5201760 commit 2768c0c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

arch/x86/kvm/vmx.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13581,14 +13581,6 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
1358113581
/* trying to cancel vmlaunch/vmresume is a bug */
1358213582
WARN_ON_ONCE(vmx->nested.nested_run_pending);
1358313583

13584-
/*
13585-
* The only expected VM-instruction error is "VM entry with
13586-
* invalid control field(s)." Anything else indicates a
13587-
* problem with L0.
13588-
*/
13589-
WARN_ON_ONCE(vmx->fail && (vmcs_read32(VM_INSTRUCTION_ERROR) !=
13590-
VMXERR_ENTRY_INVALID_CONTROL_FIELD));
13591-
1359213584
leave_guest_mode(vcpu);
1359313585

1359413586
if (vmcs12->cpu_based_vm_exec_control & CPU_BASED_USE_TSC_OFFSETING)
@@ -13615,6 +13607,16 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
1361513607
if (nested_vmx_store_msr(vcpu, vmcs12->vm_exit_msr_store_addr,
1361613608
vmcs12->vm_exit_msr_store_count))
1361713609
nested_vmx_abort(vcpu, VMX_ABORT_SAVE_GUEST_MSR_FAIL);
13610+
} else {
13611+
/*
13612+
* The only expected VM-instruction error is "VM entry with
13613+
* invalid control field(s)." Anything else indicates a
13614+
* problem with L0. And we should never get here with a
13615+
* VMFail of any type if early consistency checks are enabled.
13616+
*/
13617+
WARN_ON_ONCE(vmcs_read32(VM_INSTRUCTION_ERROR) !=
13618+
VMXERR_ENTRY_INVALID_CONTROL_FIELD);
13619+
WARN_ON_ONCE(nested_early_check);
1361813620
}
1361913621

1362013622
vmx_switch_vmcs(vcpu, &vmx->vmcs01);

0 commit comments

Comments
 (0)