Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] KVM: arm64: GICv2: Don't WARN on out-of-range GICV_DIR INTID
@ 2026-07-26 17:48 Karl Mehltretter
  2026-08-13  6:49 ` Oliver Upton
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Mehltretter @ 2026-07-26 17:48 UTC (permalink / raw)
  To: Marc Zyngier, Oliver Upton
  Cc: Karl Mehltretter, Fuad Tabba, Joey Gouly, Steffen Eiden,
	Suzuki K Poulose, Zenghui Yu, Catalin Marinas, Will Deacon,
	linux-arm-kernel, kvmarm, linux-kernel, stable

vgic_v2_deactivate() passes the INTID a guest wrote to GICV_DIR straight
to vgic_get_vcpu_irq(), and treats a failed lookup as a "can't happen"
condition with WARN_ON_ONCE().

The guest can make it happen at will, though: for any INTID outside of
the implemented SGI, PPI and SPI ranges the lookup returns NULL, since
GICv2 has no LPIs. A guest running with EOImode==1 writing such an INTID
to GICV_DIR triggers the WARN, and panics hosts running with
panic_on_warn.

Drop the WARN and ignore failed lookups.

Fixes: 255de897e7fb ("KVM: arm64: GICv2: Handle deactivation via GICV_DIR traps")
Cc: stable@vger.kernel.org
Suggested-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---
v2:
 - Drop the WARN_ON_ONCE() instead of bounding the INTID before the
   lookup, which duplicated the range check vgic_get_irq() already
   performs (Marc)
 - Retitled; was "KVM: arm64: GICv2: Bound the INTID in
   vgic_v2_deactivate()"

Link to v1: https://lore.kernel.org/r/20260725154020.37305-1-kmehltretter@gmail.com

 arch/arm64/kvm/vgic/vgic-v2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kvm/vgic/vgic-v2.c b/arch/arm64/kvm/vgic/vgic-v2.c
index cafa3cb32bda..7182f63fc938 100644
--- a/arch/arm64/kvm/vgic/vgic-v2.c
+++ b/arch/arm64/kvm/vgic/vgic-v2.c
@@ -170,8 +170,9 @@ void vgic_v2_deactivate(struct kvm_vcpu *vcpu, u32 val)
 	/* Make sure we're in the same context as LR handling */
 	local_irq_save(flags);
 
+	/* Guest-supplied INTID: out of range yields no irq, so ignore it */
 	irq = vgic_get_vcpu_irq(vcpu, val);
-	if (WARN_ON_ONCE(!irq))
+	if (!irq)
 		goto out;
 
 	/* See the corresponding v3 code for the rationale */
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] KVM: arm64: GICv2: Don't WARN on out-of-range GICV_DIR INTID
  2026-07-26 17:48 [PATCH v2] KVM: arm64: GICv2: Don't WARN on out-of-range GICV_DIR INTID Karl Mehltretter
@ 2026-08-13  6:49 ` Oliver Upton
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Upton @ 2026-08-13  6:49 UTC (permalink / raw)
  To: Marc Zyngier, Karl Mehltretter
  Cc: Oliver Upton, Fuad Tabba, Joey Gouly, Steffen Eiden,
	Suzuki K Poulose, Zenghui Yu, Catalin Marinas, Will Deacon,
	linux-arm-kernel, kvmarm, linux-kernel, stable

On Sun, 26 Jul 2026 19:48:03 +0200, Karl Mehltretter wrote:
> vgic_v2_deactivate() passes the INTID a guest wrote to GICV_DIR straight
> to vgic_get_vcpu_irq(), and treats a failed lookup as a "can't happen"
> condition with WARN_ON_ONCE().
> 
> The guest can make it happen at will, though: for any INTID outside of
> the implemented SGI, PPI and SPI ranges the lookup returns NULL, since
> GICv2 has no LPIs. A guest running with EOImode==1 writing such an INTID
> to GICV_DIR triggers the WARN, and panics hosts running with
> panic_on_warn.
> 
> [...]

Applied to next, thanks!

[1/1] KVM: arm64: GICv2: Don't WARN on out-of-range GICV_DIR INTID
      https://git.kernel.org/kvmarm/kvmarm/c/c6d9c8ac6521

--
Best,
Oliver


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-13  6:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-26 17:48 [PATCH v2] KVM: arm64: GICv2: Don't WARN on out-of-range GICV_DIR INTID Karl Mehltretter
2026-08-13  6:49 ` Oliver Upton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox