From: Marc Zyngier <maz@kernel.org>
To: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: Steffen Eiden <seiden@linux.ibm.com>,
Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Oliver Upton <oupton@kernel.org>,
Zenghui Yu <yuzenghui@huawei.com>,
Fuad Tabba <fuad.tabba@linux.dev>,
Paolo Bonzini <pbonzini@redhat.com>,
stable@vger.kernel.org,
Raghavendra Rao Ananta <rananta@google.com>,
Stefan Teodorescu <fane@google.com>,
Damiano Melotti <melotti@google.com>
Subject: [PATCH 6.1.y 2/5] KVM: arm64: vgic-its: Bound PINTID during ITE table restore
Date: Sat, 5 Dec 2026 10:41:41 +0000 [thread overview]
Message-ID: <20261205104145.1432112-3-maz@kernel.org> (raw)
In-Reply-To: <20261205104145.1432112-1-maz@kernel.org>
From: Raghavendra Rao Ananta <rananta@google.com>
commit 1e9b13ae786d3846a3722e88907e4f3b371c343f upstream.
During ITS table restore (KVM_DEV_ARM_ITS_RESTORE_TABLES), vgic_its_restore_ite()
validates only that the restored interrupt ID satisfies `lpi_id >= VGIC_MIN_LPI`
(8192) and fails to validate the upper bound against max_lpis_propbaser(propbaser).
Since the ITE PINTID field is 32-bit (bits 47:16), a guest can plant an
out-of-range LPI INTID in its own in-memory ITS tables prior to restore.
When direct MSI forwarding attaches (via kvm_vgic_v4_set_forwarding()), this
unchecked intid causes two severe consequences:
1. Out-of-Bounds Memory Write:
In its_vlpi_map(), lpi_write_config() calculates the configuration byte
target address as `page_address(map->vm->vprop_page) + hwirq - 8192`.
Since vprop_page is a 64KB page-granular host allocation and hwirq is
unbounded, this causes a 1-byte read-modify-write up to 4GB past the
allocation into neighboring memory, with both the offset and written value
controlled by the guest.
2. Hardware Command Queue Wedge (Host MSI/IRQ DoS):
Immediately following the write, its_vlpi_map() issues a physical VMAPTI
command with `virt_id = map->vintid`. Because virt_id exceeds the hardware's
architected ID limits, the physical GICv4.1 ITS command queue halts on the
malformed descriptor. The hardware read pointer becomes stuck, causing all
subsequent ITS commands to time out and permanently breaking host-wide MSI
handling until reboot:
ITS cmd its_build_discard_cmd failed
ITS queue timeout (24768 24481)
ITS cmd its_build_mapd_cmd failed
ITS queue timeout (24800 24481)
ITS cmd its_build_vmapp_cmd failed
Fix this by validating the upper bound of lpi_id against max_lpis_propbaser()
in vgic_its_restore_ite(), mirroring the check in vgic_its_cmd_handle_mapi().
Fixes: eff484e0298d ("KVM: arm64: vgic-its: ITT save and restore")
Reported-by: Stefan Teodorescu <fane@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
Signed-off-by: Damiano Melotti <melotti@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
arch/arm64/kvm/vgic/vgic-its.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c
index 5622c7edd172c..3cefeb39debf5 100644
--- a/arch/arm64/kvm/vgic/vgic-its.c
+++ b/arch/arm64/kvm/vgic/vgic-its.c
@@ -2300,7 +2300,8 @@ static int vgic_its_restore_ite(struct vgic_its *its, u32 event_id,
if (!lpi_id)
return 1; /* invalid entry, no choice but to scan next entry */
- if (lpi_id < VGIC_MIN_LPI)
+ if (lpi_id < VGIC_MIN_LPI ||
+ lpi_id >= max_lpis_propbaser(kvm->arch.vgic.propbaser))
return -EINVAL;
offset = val >> KVM_ITS_ITE_NEXT_SHIFT;
--
2.47.3
next prev parent reply other threads:[~2026-12-05 10:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 10:41 [PATCH 6.1.y 0/5] KVM/arm64 stable fixes Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.1.y 1/5] KVM: arm64: vgic-its: Stop the VM when handling MOVALL Marc Zyngier
2026-12-05 10:41 ` Marc Zyngier [this message]
2026-12-05 10:41 ` [PATCH 6.1.y 3/5] irqchip/gic-v4: Contain VMAPTI vINTID to the expected boundaries Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.1.y 4/5] KVM: arm64: vgic-its: Add signal checks in scan_its_table() Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.1.y 5/5] KVM: arm64: vgic: Linearise AP list pruning process Marc Zyngier
2026-12-05 10:55 ` 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=20261205104145.1432112-3-maz@kernel.org \
--to=maz@kernel.org \
--cc=fane@google.com \
--cc=fuad.tabba@linux.dev \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=melotti@google.com \
--cc=oupton@kernel.org \
--cc=pbonzini@redhat.com \
--cc=rananta@google.com \
--cc=seiden@linux.ibm.com \
--cc=stable@vger.kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.com \
/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