From: sashiko-bot@kernel.org
To: "Fuad Tabba" <fuad.tabba@linux.dev>
Cc: "Oliver Upton" <oupton@kernel.org>,
kvmarm@lists.linux.dev, "Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH v2 1/4] KVM: arm64: vgic-its: Free the caches when GITS_BASER changes
Date: Fri, 21 Aug 2026 06:57:42 +0000 [thread overview]
Message-ID: <20260821065743.3563C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260821064445.615838-2-fuad.tabba@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Pre-existing race condition in ITS MMIO handler allows MSI injection while ITS is disabled due to a stale translation cache entry.
--
--- Patch [1]: [PATCH v2 1/4] KVM: arm64: vgic-its: Free the caches when GITS_BASER changes ---
commit 98c89973da07ed23e9bd8348bfd2cf61333c4e66
Author: Fuad Tabba <fuad.tabba@linux.dev>
KVM: arm64: vgic-its: Free the caches when GITS_BASER changes
A guest that disables the ITS and changes GITS_BASER<n> with VALID still set
keeps the mapped devices and collections. This patch frees the list and
drops the translation cache whenever the stored value changes.
Link: https://lore.kernel.org/all/87ecg9owwa.wl-maz@kernel.org/
> diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c
> index 9e782a4fea7e5..ab89b0138efd0 100644
> --- a/arch/arm64/kvm/vgic/vgic-its.c
> +++ b/arch/arm64/kvm/vgic/vgic-its.c
[ ... ]
> @@ -1702,6 +1705,8 @@ static void vgic_mmio_write_its_baser(struct kvm *kvm,
> vgic_its_free_collection_list(kvm, its);
> break;
> }
> + /* A concurrent injection may have cached a translation. */
> + vgic_its_invalidate_cache(its);
[Severity: High]
This is a pre-existing issue, but the commit message explicitly notes that
an injection can still cache an entry after the ITS is disabled.
Is it possible for a subsequent MSI to trigger an unexpected LPI injection?
If Thread 1 (e.g. irqfd) calls vgic_its_inject_msi(), takes its_lock, and
enters vgic_its_resolve_lpi() in arch/arm64/kvm/vgic/vgic-its.c, it reads
its->enabled as true.
If Thread 2 (guest vCPU) concurrently disables the ITS via
vgic_mmio_write_its_ctlr(), it acquires cmd_lock (but not its_lock), sets
its->enabled to false, and clears the cache.
Thread 1 could then resume, finish resolving the LPI, and call
vgic_its_cache_translation() to insert the entry into the cache, ignoring the
fact that its->enabled is now false.
A subsequent MSI would then hit vgic_its_inject_cached_translation(), which
does a fast-path lookup without checking its->enabled, successfully injecting
the MSI.
Could this violate the GICv3 specification by delivering LPIs while the ITS
is explicitly disabled, potentially crashing a guest OS during kexec?
> mutex_unlock(&its->its_lock);
> }
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821064445.615838-1-fuad.tabba@linux.dev?part=1
next prev parent reply other threads:[~2026-08-21 6:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 6:44 [PATCH v2 0/4] KVM: arm64: vgic-its: Make the ITS table save reliable Fuad Tabba
2026-08-21 6:44 ` [PATCH v2 1/4] KVM: arm64: vgic-its: Free the caches when GITS_BASER changes Fuad Tabba
2026-08-21 6:57 ` sashiko-bot [this message]
2026-08-21 7:37 ` Fuad Tabba
2026-08-21 8:50 ` Marc Zyngier
2026-08-21 8:55 ` Fuad Tabba
2026-08-21 6:44 ` [PATCH v2 2/4] Revert "KVM: arm64: vgic-its: Don't save collections the table cannot hold" Fuad Tabba
2026-08-21 6:44 ` [PATCH v2 3/4] KVM: arm64: vgic-its: Skip unreachable devices instead of failing the save Fuad Tabba
2026-08-21 6:44 ` [PATCH v2 4/4] KVM: arm64: selftests: Add ITS table save tests Fuad Tabba
2026-08-21 7:00 ` sashiko-bot
2026-08-21 7:51 ` Fuad Tabba
2026-08-22 8:02 ` [PATCH v2 0/4] KVM: arm64: vgic-its: Make the ITS table save reliable Marc Zyngier
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=20260821065743.3563C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=fuad.tabba@linux.dev \
--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