From: sashiko-bot@kernel.org
To: "Pratik R. Sampat" <prsampat@amd.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 1/3] KVM: SVM: Re-queue events that were never injected
Date: Mon, 14 Sep 2026 17:16:28 +0000 [thread overview]
Message-ID: <20260914171628.8A4631F00893@smtp.kernel.org> (raw)
In-Reply-To: <d946de080e3dd34844a665c167179e4910fdc9d4.1789399214.git.prsampat@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] svm_complete_interrupts() incorrectly checks if (control->event_inj) instead of the SVM_EVTINJ_VALID bit, which can silently drop valid hardware-reported events (like guest page faults) by clobbering EXITINTINFO.
--
commit 50716e3ba11eb9d000a0186ffad984ac08df1dcb
Author: Pratik R. Sampat <prsampat@amd.com>
KVM: SVM: Re-queue events that were never injected
When injecting an event into the guest via the event_inj field, a non-zero
event_inj value on #VMEXIT means the hardware was unable to inject it.
This commit adds a check to recover potentially lost interrupts by detecting
an undelivered injected event and re-queuing it.
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index d0971685034b9..e2be2cd86c320 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
[ ... ]
> @@ -4323,6 +4324,27 @@ static void svm_complete_interrupts(struct kvm_vcpu *vcpu)
> svm->nmi_l1_to_l2 = false;
> svm->soft_int_injected = false;
>
> + /*
> + * Hardware clears EVENTINJ field when it injects an event.
> + * A non-empty EVENTINJ on #VMEXIT means the vCPU never entered guest
> + * mode, and thus that the event was never delivered. Migrate the event
> + * to EXITINTINFO so that it's requeued instead of being dropped.
> + *
> + * An undelivered event doesn't imply a fatal VMEXIT_INVALID. With
> + * Enhanced SMT Protection, VMRUN may exit with an ordinary #VMEXIT
> + * without having injected that event into the guest.
> + *
> + * Clobbering EXITINTINFO is safe precisely because the vCPU never
> + * entered guest mode.
> + */
> + if (control->event_inj) {
[Severity: High]
Does this code silently drop valid hardware-reported events?
If an L1 hypervisor sets event_inj to a non-zero value but leaves the
SVM_EVTINJ_VALID bit clear, hardware will ignore the injection and won't
clear EVENTINJ.
If a genuine exception occurs in the L2 guest that populates EXITINTINFO,
this check incorrectly evaluates to true since event_inj is non-zero.
This causes EXITINTINFO to be clobbered with the L1's invalid event_inj
data. Because the clobbered value lacks the VALID bit, KVM will then ignore
it and drop the event.
Should this code check the SVM_EVTINJ_VALID bit instead of checking for a
non-zero event_inj value?
> + control->exit_int_info = control->event_inj;
> + control->exit_int_info_err = control->event_inj_err;
> + control->event_inj = 0;
> +
> + exitintinfo = control->exit_int_info;
> + }
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1789399214.git.prsampat@amd.com?part=1
next prev parent reply other threads:[~2026-09-14 17:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 16:55 [PATCH 0/3] Introduce Enhanced SMT Protection for SEV-SNP Pratik R. Sampat
2026-09-14 16:55 ` [PATCH 1/3] KVM: SVM: Re-queue events that were never injected Pratik R. Sampat
2026-09-14 17:16 ` sashiko-bot [this message]
2026-09-17 15:07 ` Pratik R. Sampat
2026-09-21 16:15 ` Sean Christopherson
2026-09-22 20:45 ` Pratik R. Sampat
2026-09-21 13:16 ` Sean Christopherson
2026-09-22 20:45 ` Pratik R. Sampat
2026-09-14 16:55 ` [PATCH 2/3] KVM: SVM: Add host support for Enhanced SMT Protection Pratik R. Sampat
2026-09-14 17:13 ` sashiko-bot
2026-09-17 15:07 ` Pratik R. Sampat
2026-09-16 19:56 ` Borislav Petkov
2026-09-17 15:07 ` Pratik R. Sampat
2026-09-14 16:55 ` [PATCH 3/3] x86/sev: Add guest " Pratik R. Sampat
2026-09-14 17:11 ` sashiko-bot
2026-09-17 15:07 ` Pratik R. Sampat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260914171628.8A4631F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=prsampat@amd.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.