Skip to content

Commit 8c23670

Browse files
committed
KVM: nVMX: Suppress external interrupt VM-Exit injection if there's no IRQ
In the should-be-impossible scenario that kvm_cpu_get_interrupt() doesn't return a valid vector after checking kvm_cpu_has_interrupt(), skip VM-Exit injection to reduce the probability of crashing/confusing L1. Now that KVM gets the IRQ _before_ calling nested_vmx_vmexit(), squashing the VM-Exit injection is trivial since there are no actions that need to be undone. Reviewed-by: Chao Gao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 363010e commit 8c23670

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kvm/vmx/nested.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4305,7 +4305,8 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
43054305
}
43064306

43074307
irq = kvm_apic_has_interrupt(vcpu);
4308-
WARN_ON_ONCE(irq < 0);
4308+
if (WARN_ON_ONCE(irq < 0))
4309+
goto no_vmexit;
43094310

43104311
nested_vmx_vmexit(vcpu, EXIT_REASON_EXTERNAL_INTERRUPT,
43114312
INTR_INFO_VALID_MASK | INTR_TYPE_EXT_INTR | irq, 0);

0 commit comments

Comments
 (0)