summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSascha Bischoff <Sascha.Bischoff@arm.com>2026-08-11 15:11:18 +0000
committerOliver Upton <oupton@kernel.org>2026-08-19 12:23:01 -0700
commit2962174fdfa63e272082ea7ae989a8fdef29bd0e (patch)
treee709def14cf5d364a9bdb67daeb9f3af391e81c4 /include
parent93cfad8da7164b095b2402ec9b2067fa15d6f250 (diff)
downloadlinux-2962174fdfa63e272082ea7ae989a8fdef29bd0e.tar.gz
linux-2962174fdfa63e272082ea7ae989a8fdef29bd0e.zip
KVM: arm64: vgic: Reject out-of-range GICv5 PPI IDs
GICv5 supports up to 128 PPIs, but KVM currently implements only the first 64, which contain the architected PPIs it supports. An encoded PPI with an ID outside that range passes irq_is_ppi(), which only checks the encoded interrupt type. vgic_get_vcpu_irq() therefore looks it up in private_irqs[], where array_index_nospec() clamps the out-of-range index to zero and aliases PPI 0. Include the supported PPI range in irq_is_ppi() so that KVM interfaces reject unsupported PPIs. Also reject an out-of-range PPI in the lookup as a safeguard against callers bypassing the predicate. Fixes: 4d591252bacb ("KVM: arm64: gic-v5: Implement PPI interrupt injection") Fixes: eb8bce08ecb1 ("KVM: arm64: gic: Introduce interrupt type helpers") Link: https://sashiko.dev/#/patchset/20260724104819.1296803-1-sascha.bischoff@arm.com?part=27 Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com> Reviewed-by: Joey Gouly <joey.gouly@arm.com> Reviewed-by: Marc Zyngier <maz@kernel.org> Link: https://patch.msgid.link/20260811150941.941295-4-sascha.bischoff@arm.com Signed-off-by: Oliver Upton <oupton@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/kvm/arm_vgic.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index fe49fb56dc3c..41012457841c 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -65,6 +65,8 @@
switch (t) { \
case KVM_DEV_TYPE_ARM_VGIC_V5: \
__ret = is_v5_type(GICV5_HWIRQ_TYPE_PPI, (i)); \
+ __ret &= FIELD_GET(GICV5_HWIRQ_ID, (i)) < \
+ VGIC_V5_NR_PRIVATE_IRQS; \
break; \
default: \
__ret = (i) >= VGIC_NR_SGIS; \