[PATCH 3/4] KVM: arm64: vgic-its: Add signal checks in scan_its_table()

From: Paolo Bonzini

Date: Fri Dec 04 2026 - 12:58:11 EST


From: Raghavendra Rao Ananta <rananta@xxxxxxxxxx>

During ITS table restore (KVM_DEV_ARM_ITS_RESTORE_TABLES), scan_its_table()
walks guest RAM to restore Device Table Entries (DTEs) and Interrupt
Translation Tables (ITTs) while holding kvm->lock, all vCPU mutexes,
kvm->arch.config_lock, and its->its_lock.

Because a guest can plant valid DTEs with num_eventid_bits = 16 (size = 15,
or 65,536 EventIDs per device) pointing to zeroed/sparse ITT memory
(!lpi_id), vgic_its_restore_ite() returns +1 for each unmapped entry. This
forces scan_its_table() to scan up to 65,536 entries per device (up to
4.30B reads for a 1-level flat table or 21.48B reads for a 2-level indirect
table).

Because scan_its_table() lacks signal checks, executing
KVM_DEV_ARM_ITS_RESTORE_TABLES monopolizes the host CPU in kernel
space for tens to hundreds of seconds.

Fix this by checking signal_pending(current) at the start of the
scan_its_table() loop to allow immediate cancellation (-EINTR) if a VMM
timeout or termination signal arrives.

Fixes: 920a7a8fa92a ("KVM: arm64: vgic-its: Add infrastructure for table lookup")
Reported-by: Stefan Teodorescu <fane@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Raghavendra Rao Ananta <rananta@xxxxxxxxxx>
Signed-off-by: Damiano Melotti <melotti@xxxxxxxxxx>
Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
---
arch/arm64/kvm/vgic/vgic-its.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c
index 82f7d052efcb..9c81a8656e94 100644
--- a/arch/arm64/kvm/vgic/vgic-its.c
+++ b/arch/arm64/kvm/vgic/vgic-its.c
@@ -2171,6 +2171,9 @@ static int scan_its_table(struct vgic_its *its, gpa_t base, int size, u32 esz,
int next_offset;
size_t byte_offset;

+ if (signal_pending(current))
+ return -EINTR;
+
ret = kvm_read_guest_lock(kvm, gpa, entry, esz);
if (ret)
return ret;
--
2.56.1