Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796407071; b=WJPgxMTj3Ab8cEKIxMoipXqFF/qjh9xwcUceLAYW3CdssMZt4o8BjiR2/eP4kOJ9uNMH TPJaKpvn4TsqF6EI4oW44Aeo2BNOIGQb5xeE/2K9PwCHqyWhQuJaF0ZlLDKoMKdwx76bc Bf1xShdpATJ1IELpNEM1FL8iJmEQxyncu5DU+VoFdAvlbrOlZrqqwDmN2Wi9rUBQl60aN kJZPgR4dNYIvM+fmte2WTwninQsdEJQXGkUQ35eITStwwcDL/9TlwrhBDonjOZyn2xuJL 3NUYLN2y0SY5uIp5iJEHoOVkmr2PnGFo5fp1HqFHtvaAoDzVrl08ay4p2ccx1Gr3C/Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796407071; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:From:To:Cc:Subject:Date: Message-ID:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Scanned-By; bh=kodkBmQ+i5oNFBDPqxdPH5UHLkN4U+BMg2YHYudhaIY=; b=r+zSF0AKv8fhbMbebi9bIFogUthOShI9WbXABF4H4jAljWm4uikRgAOI325KThpVqYIA 4IbgBNCOnyDy7FE9gGzUkDR8xSWt+s6Y/b5+iwLXU4y/lgcNzXC1q7GL40R64HBFRy+dH Li0VfGtUM71kmv6qY7GzWTWuhNnwT+Mgp2yZzYEIZDZWNdQ2+rids8uMZVQ3/9xyiVMDb 7JgH33MbRDWMYIcdZxSt+k2VRnYTijMpfGnZOt6FNTQiZdHVNYUmc0UIw6A6iCA3O9jwS V6e9R9KtGUgYm/76W7a2ru91fjdLs0iGyK4eDO6qx10fIzgmLOosfff2v/6VL+D9lDg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=G2KpYBDX; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AC12606A32F for ; Fri, 4 Dec 2026 17:57:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6AC12606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=G2KpYBDX DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796407070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kodkBmQ+i5oNFBDPqxdPH5UHLkN4U+BMg2YHYudhaIY=; b=G2KpYBDXMzrzsPScipwjnYHzg/A0XPlGaBCBawxRM+GhbWlYjL+Jjd0hEPq3tqd2v9e+VT lWc3vCul3Bg2DPkUaPva/zdFMzWhAkCu6PUbGLGAFCmXVQpJ6swrkpNqQPVCRPmZWQWhas srkx7gsMBeYo2X0XIzAoHk6yMDCFp54= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS with 8BITMIME (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-711-Rl-mxGYnP_y5ZweKHJK-xA-1; Fri, 4 Dec 2026 17:57:47 +0000 X-MC-Unique: Rl-mxGYnP_y5ZweKHJK-xA-1 X-Mimecast-MFC-AGG-ID: Rl-mxGYnP_y5ZweKHJK-xA_1796407066 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E9C9018C0D98; Fri, 4 Dec 2026 17:57:45 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7E70618019EC; Fri, 4 Dec 2026 17:57:43 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: maz@kernel.org, oupton@kernel.org, kvmarm@lists.linux.dev, Raghavendra Rao Ananta , Stefan Teodorescu , stable@vger.kernel.org, Damiano Melotti Subject: [PATCH 1/4] KVM: arm64: vgic-its: Bound PINTID during ITE table restore Date: Fri, 4 Dec 2026 18:57:37 +0100 Message-ID: <20261204175740.2153746-2-pbonzini@redhat.com> In-Reply-To: <20261204175740.2153746-1-pbonzini@redhat.com> References: <20261204175740.2153746-1-pbonzini@redhat.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 From: Raghavendra Rao Ananta 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 Cc: stable@vger.kernel.org Signed-off-by: Raghavendra Rao Ananta Signed-off-by: Damiano Melotti Signed-off-by: Marc Zyngier --- 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 7e9b265b1f52..82f7d052efcb 100644 --- a/arch/arm64/kvm/vgic/vgic-its.c +++ b/arch/arm64/kvm/vgic/vgic-its.c @@ -2248,7 +2248,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.56.1