[PATCH v2] KVM: arm64: GICv2: Don't WARN on out-of-range GICV_DIR INTID
From: Karl Mehltretter
Date: Sun Jul 26 2026 - 13:49:31 EST
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@xxxxxxxxxxxxxxx
Suggested-by: Marc Zyngier <maz@xxxxxxxxxx>
Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>
---
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@xxxxxxxxx
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