From: Eric Auger <eric.auger@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: eric.auger.pro@gmail.com, qemu-devel@nongnu.org,
qemu-arm@nongnu.org, peter.maydell@linaro.org,
skolothumtho@nvidia.com, nicolinc@nvidia.com, nathanc@nvidia.com
Subject: Re: [PATCH 2/2] hw/arm/smmuv3: Sanitize SMMU_S_STRTAB_BASE_CFG.LOG2SIZE
Date: Tue, 30 Jun 2026 15:13:51 +0200 [thread overview]
Message-ID: <a034d5c4-02a5-43a1-b453-2c1dec59a5cc@redhat.com> (raw)
In-Reply-To: <akOJ8SNPV_I48tD_@redhat.com>
On 6/30/26 11:18 AM, Daniel P. Berrangé wrote:
> On Tue, Jun 30, 2026 at 10:30:20AM +0200, Eric Auger wrote:
>> STRTAB_BASE_CFG.LOG2SIZE is programmed by the guest through the
>> emulated SMMUv3 MMIO register interface. Currently the value is
>> not checked.
>>
>> The SMMU spec says: "Except for readback of a written value, the
>> effective LOG2SIZE is <= SMMU_IDR1.SIDSIZE for the purposes of
>> input StreamID range checking and upper/lower/linear Stream table
>> index address calculation."
>>
>> So for STE lookup make sure log2size is capped at SMMU_IDR1.SIDSIZE.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>> ---
>> hw/arm/smmuv3.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
> Can you add the "Resolves: bug URL" to the commit message so it
> gets auto-closed on merge.
sure. Thanks for the hint
Eric
>
>> diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
>> index 0a8d2fbb6a7..db5aca26ec0 100644
>> --- a/hw/arm/smmuv3.c
>> +++ b/hw/arm/smmuv3.c
>> @@ -672,6 +672,15 @@ int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste, SMMUEventInfo *event)
>> /*
>> * Check SID range against both guest-configured and implementation limits
>> */
>> + if (log2size > SMMU_IDR1_SIDSIZE) {
>> + /*
>> + * spec says: Except for readback of a written value, the effective
>> + * LOG2SIZE is <= SMMU_IDR1.SIDSIZE for the purposes of input StreamID
>> + * range checking and upper/lower/linear Stream table index address
>> + * calculation.
>> + */
>> + log2size = SMMU_IDR1_SIDSIZE;
>> + }
>> if (sid >= (1 << MIN(log2size, SMMU_IDR1_SIDSIZE))) {
>> event->type = SMMU_EVT_C_BAD_STREAMID;
>> return -EINVAL;
>> --
>> 2.53.0
>>
> With regards,
> Daniel
next prev parent reply other threads:[~2026-06-30 13:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 8:30 [PATCH 0/2] Sanitize SMMU_S_STRTAB_BASE_CFG LOG2SIZE and SPLIT Eric Auger
2026-06-30 8:30 ` [PATCH 1/2] hw/arm/smmuv3: Sanitize SMMU_S_STRTAB_BASE_CFG.SPLIT Eric Auger
2026-06-30 9:11 ` Shameer Kolothum Thodi
2026-06-30 13:11 ` Eric Auger
2026-06-30 8:30 ` [PATCH 2/2] hw/arm/smmuv3: Sanitize SMMU_S_STRTAB_BASE_CFG.LOG2SIZE Eric Auger
2026-06-30 9:18 ` Daniel P. Berrangé
2026-06-30 13:13 ` Eric Auger [this message]
2026-06-30 9:43 ` Shameer Kolothum Thodi
2026-06-30 15:45 ` Eric Auger
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=a034d5c4-02a5-43a1-b453-2c1dec59a5cc@redhat.com \
--to=eric.auger@redhat.com \
--cc=berrange@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=nathanc@nvidia.com \
--cc=nicolinc@nvidia.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=skolothumtho@nvidia.com \
/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.