Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Paolo Bonzini" <pbonzini@redhat.com>, kvm@vger.kernel.org
Cc: kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>,
	"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH 1/4] KVM: arm64: vgic-its: Bound PINTID during ITE table restore
Date: Fri, 04 Dec 2026 18:14:42 +0000	[thread overview]
Message-ID: <sashiko-outbox-250394@kernel.org> (raw)
In-Reply-To: <20261204175740.2153746-2-pbonzini@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] KVM: arm64: vgic_its_restore_ite() rejects saved ITEs after
  PROPBASER shrink
--

commit 350aaf29f4addc9485e47e0e35ae2fc1cf8fd8eb
Author: Raghavendra Rao Ananta <rananta@google.com>

KVM: arm64: vgic-its: Bound PINTID during ITE table restore

This commit adds an upper-bound check against max_lpis_propbaser() for
lpi_id in vgic_its_restore_ite() during ITS table restore.

> diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c
> index 7e9b265b1f521..82f7d052efcb3 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;

[Severity: Medium]
Can this check break KVM_DEV_ARM_ITS_RESTORE_TABLES on ITS tables
legitimately saved by KVM_DEV_ARM_ITS_SAVE_TABLES?

A guest can map an LPI with MAPTI under a larger GICR_PROPBASER.IDbits
and later shrink IDbits via vgic_mmio_write_propbase() on a vCPU with
LPIs disabled.  Shrinking dist->propbaser does not discard existing ITEs,
leaving an ITE with intid >= max_lpis_propbaser(propbaser).

vgic_its_save_ite() saves every mapped ITE without checking
max_lpis_propbaser(propbaser).  When userspace restores the shrunken
GICR_PROPBASER before KVM_DEV_ARM_ITS_RESTORE_TABLES, this check now
returns -EINVAL and aborts live migration or snapshot restore.

Skipping ITEs outside max_lpis_propbaser(propbaser) in vgic_its_save_ite()
and compute_next_eventid_offset() would preserve save/restore symmetry
while keeping this bound check.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204175740.2153746-1-pbonzini@redhat.com?part=1

  reply	other threads:[~2026-12-04 18:14 UTC|newest]

Thread overview: 8+ 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-04 18:14   ` sashiko-bot [this message]
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 ` [PATCH 3/4] KVM: arm64: vgic-its: Add signal checks in scan_its_table() Paolo Bonzini
2026-12-04 18:23   ` sashiko-bot
2026-12-04 17:57 ` [PATCH 4/4] KVM: arm64: vgic: Linearise AP list pruning process Paolo Bonzini
2026-12-04 18:21   ` 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=sashiko-outbox-250394@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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