Commit 8c23670f authored by Sean Christopherson's avatar Sean Christopherson
Browse files

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: default avatarChao Gao <chao.gao@intel.com>
Link: https://lore.kernel.org/r/20240906043413.1049633-4-seanjc@google.com


Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent 363010e1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4305,7 +4305,8 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
		}

		irq = kvm_apic_has_interrupt(vcpu);
		WARN_ON_ONCE(irq < 0);
		if (WARN_ON_ONCE(irq < 0))
			goto no_vmexit;

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