From: sashiko-bot@kernel.org
To: "Dan Carpenter" <dan@pereq.eu>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
"Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH v4 5/9] KVM: arm64: nv: Discard nested SError in kvm_reset_vcpu()
Date: Fri, 04 Dec 2026 09:03:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-249458@kernel.org> (raw)
In-Reply-To: <20261204-double_exception_v4-v4-5-523921511673@pereq.eu>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] KVM: arm64: non-atomic hcr_el2 RMW in kvm_reset_vcpu() races
with IRQ line
--
commit 5201009befa259c3dab07b05344d615312140b11
Author: Dan Carpenter <dan@pereq.eu>
KVM: arm64: nv: Discard nested SError in kvm_reset_vcpu()
This commit clears the NESTED_SERROR_PENDING flag in kvm_reset_vcpu() so
that pending nested SErrors are discarded on vCPU reset.
> diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c
> index 4b1917b48edcb..1899d927164c1 100644
> --- a/arch/arm64/kvm/reset.c
> +++ b/arch/arm64/kvm/reset.c
> @@ -206,6 +206,7 @@ void kvm_reset_vcpu(struct kvm_vcpu *vcpu)
>
> /* Discard a pending SError */
> vcpu->arch.hcr_el2 &= ~HCR_EL2_VSE;
> + vcpu_clear_flag(vcpu, NESTED_SERROR_PENDING);
[Severity: Medium]
Can the non-atomic update to vcpu->arch.hcr_el2 (from commit "KVM: arm64:
Discard a pending SError when resetting a vcpu") lose a concurrent virtual
IRQ or FIQ line transition?
For a VM without an in-kernel irqchip, KVM_IRQ_LINE runs without
vcpu->mutex and calls vcpu_interrupt_line(), which atomically sets or
clears HCR_EL2_VI or HCR_EL2_VF in vcpu->arch.hcr_el2:
CPU0 CPU1
kvm_reset_vcpu() kvm_vm_ioctl(KVM_IRQ_LINE)
/* holds vcpu->mutex */ kvm_vm_ioctl_irq_line()
load vcpu->arch.hcr_el2 vcpu_interrupt_line()
test_and_set_bit(VI, hcr)
store hcr_el2 & ~HCR_EL2_VSE <-- overwrites HCR_EL2_VI
When that happens, the concurrent interrupt line update is silently
overwritten, leaving the guest with a missed or stuck virtual interrupt.
Using clear_bit(__ffs(HCR_EL2_VSE), vcpu_hcr(vcpu)) would avoid this data
race.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-double_exception_v4-v4-0-523921511673@pereq.eu?part=5
next prev parent reply other threads:[~2026-12-04 9:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 8:48 [PATCH v4 0/9] KVM: arm64: Fix kvm_reset_vcpu() and SError handling for nested virt Dan Carpenter
2026-12-04 8:48 ` [PATCH v4 1/9] KVM: arm64: nv: Use a vcpu request to reprogram the PMU Dan Carpenter
2026-12-04 8:48 ` [PATCH v4 2/9] KVM: arm64: Drop an incomplete MMIO access when resetting a vcpu Dan Carpenter
2026-12-04 8:48 ` [PATCH v4 3/9] KVM: arm64: Reset SP_EL1, ELR_EL1 and SPSR_EL1 " Dan Carpenter
2026-12-04 8:48 ` [PATCH v4 4/9] KVM: arm64: Discard a pending SError " Dan Carpenter
2026-12-04 9:03 ` sashiko-bot
2026-12-04 8:48 ` [PATCH v4 5/9] KVM: arm64: nv: Discard nested SError in kvm_reset_vcpu() Dan Carpenter
2026-12-04 9:03 ` sashiko-bot [this message]
2026-12-04 8:48 ` [PATCH v4 6/9] KVM: arm64: nv: Replace a pending SError when injecting a new one Dan Carpenter
2026-12-04 8:48 ` [PATCH v4 7/9] KVM: arm64: nv: Don't deliver a pending SError to the wrong guest Dan Carpenter
2026-12-04 9:17 ` sashiko-bot
2026-12-04 8:48 ` [PATCH v4 8/9] KVM: arm64: nv: Re-inject a stored SError after the exit is handled Dan Carpenter
2026-12-04 9:22 ` sashiko-bot
2026-12-04 8:48 ` [PATCH v4 9/9] KVM: arm64: selftests: Test that a vcpu reset clears the vcpu's state Dan Carpenter
2026-12-04 9:20 ` sashiko-bot
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=sashiko-outbox-249458@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dan@pereq.eu \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox