mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: maz@kernel.org, oupton@kernel.org, kvmarm@lists.linux.dev,
	Raghavendra Rao Ananta <rananta@google.com>,
	Stefan Teodorescu <fane@google.com>,
	stable@vger.kernel.org, Damiano Melotti <melotti@google.com>
Subject: [PATCH 3/4] KVM: arm64: vgic-its: Add signal checks in scan_its_table()
Date: Fri,  4 Dec 2026 18:57:39 +0100	[thread overview]
Message-ID: <20261204175740.2153746-4-pbonzini@redhat.com> (raw)
In-Reply-To: <20261204175740.2153746-1-pbonzini@redhat.com>

From: Raghavendra Rao Ananta <rananta@google.com>

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@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, 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



  parent reply	other threads:[~2026-12-04 17:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 17:57 [PATCH 0/4] Fixes for various kvm-arm vulnerabilities Paolo Bonzini
2026-12-04 17:57 ` [PATCH 1/4] KVM: arm64: vgic-its: Bound PINTID during ITE table restore Paolo Bonzini
2026-12-05 22:44   ` Thomas Gleixner
2026-12-04 17:57 ` [PATCH 2/4] irqchip/gic-v4: Contain VMAPTI vINTID to the expected boundaries Paolo Bonzini
2026-12-04 17:57 ` Paolo Bonzini [this message]
2026-12-04 17:57 ` [PATCH 4/4] KVM: arm64: vgic: Linearise AP list pruning process Paolo Bonzini

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=20261204175740.2153746-4-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=fane@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=melotti@google.com \
    --cc=oupton@kernel.org \
    --cc=rananta@google.com \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®