From: sashiko-bot@kernel.org
To: "Fuad Tabba" <fuad.tabba@linux.dev>
Cc: "Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>,
kvmarm@lists.linux.dev
Subject: Re: [PATCH 3/3] KVM: arm64: vgic-its: Don't write past the end of the collection table
Date: Wed, 05 Aug 2026 09:55:00 +0000 [thread overview]
Message-ID: <20260805095501.8E1461F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260805093828.3626610-4-fuad.tabba@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Medium] vgic_its_save_collection_table() saves collections with IDs that exceed the current GITS_BASER size, generating an invalid migration state that fails on restore.
--
--- Patch [3]: [PATCH 3/3] KVM: arm64: vgic-its: Don't write past the end of the collection table ---
commit d0eca2d07d6d3c4d13e7fff1329f9d14363bb0f5
Author: Fuad Tabba <fuad.tabba@linux.dev>
KVM: arm64: vgic-its: Don't write past the end of the collection table
This commit limits the number of collection table entries saved during
migration to avoid writing past the end of the guest memory table. It
aborts the save operation with -EINVAL if the guest has mapped more
collections than fit in the current table.
> diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c
> index ed281fbf008b9..c709fc5e17cda 100644
> --- a/arch/arm64/kvm/vgic/vgic-its.c
> +++ b/arch/arm64/kvm/vgic/vgic-its.c
> @@ -2540,6 +2540,9 @@ static int vgic_its_save_collection_table(struct vgic_its *its)
> max_size = GITS_BASER_NR_PAGES(baser) * SZ_64K;
>
> list_for_each_entry(collection, &its->collection_list, coll_list) {
> + if (filled == max_size)
> + return -EINVAL;
> +
> ret = vgic_its_save_cte(its, collection, gpa);
[Severity: Medium]
This is a pre-existing issue, but does this code save collections with IDs
that exceed the current GITS_BASER size?
If a guest maps a collection with a large ID, and then shrinks the table size
in GITS_BASER while keeping VALID=1, the collection list isn't freed. Since
the total number of mapped collections might still be small enough to pass the
filled == max_size check, it appears the collection with the large ID will
be successfully saved here.
On the destination side, when vgic_its_restore_cte() reads this entry, it
calls vgic_its_check_id() which checks the ID against the shrunken boundaries,
returning -EINVAL and failing the migration.
Should this path also validate the collection ID against the current table
size, similar to how vgic_its_save_device_tables() uses vgic_its_check_id()?
> if (ret)
> return ret;
> gpa += cte_esz;
> filled += cte_esz;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260805093828.3626610-1-fuad.tabba@linux.dev?part=3
next prev parent reply other threads:[~2026-08-05 9:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 9:38 [PATCH 0/3] KVM: arm64: vgic: Fixes for ITS table save and init retry Fuad Tabba
2026-08-05 9:38 ` [PATCH 1/3] KVM: arm64: vgic-its: Don't dereference a NULL collection on ITT save Fuad Tabba
2026-08-06 4:43 ` Oliver Upton
2026-08-06 7:41 ` Fuad Tabba
2026-08-05 9:38 ` [PATCH 2/3] KVM: arm64: vgic: Don't leak the SPI array when init is retried Fuad Tabba
2026-08-05 9:38 ` [PATCH 3/3] KVM: arm64: vgic-its: Don't write past the end of the collection table Fuad Tabba
2026-08-05 9:55 ` sashiko-bot [this message]
2026-08-05 10:49 ` Fuad Tabba
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=20260805095501.8E1461F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=fuad.tabba@linux.dev \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.