> -----Original Message-----
> From: Eric Auger <[email protected]>
> Sent: 30 June 2026 09:30
> To: [email protected]; [email protected]; qemu-
> [email protected]; [email protected]; [email protected];
> [email protected]; Shameer Kolothum Thodi
> <[email protected]>; Nicolin Chen <[email protected]>; Nathan
> Chen <[email protected]>
> Subject: [PATCH 1/2] hw/arm/smmuv3: Sanitize
> SMMU_S_STRTAB_BASE_CFG.SPLIT
> 
> External email: Use caution opening links or attachments
> 
> 
> Currently the guest value for the SPLIT field is not checked.
> Also the spec says that values different from 6, 8, 10, respectively
> meaning 4KB, 16kB and 64kB leaf tables are reserved and behave as 6.
> 
> Signed-off-by: Eric Auger <[email protected]>
> ---
>  hw/arm/smmuv3.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
> index 5e5a6a960c9..0a8d2fbb6a7 100644
> --- a/hw/arm/smmuv3.c
> +++ b/hw/arm/smmuv3.c
> @@ -1688,6 +1688,13 @@ static MemTxResult smmu_writel(SMMUv3State
> *s, hwaddr offset,
>          s->strtab_base_cfg = data;
>          if (FIELD_EX32(data, STRTAB_BASE_CFG, FMT) == 1) {
>              s->sid_split = FIELD_EX32(data, STRTAB_BASE_CFG, SPLIT);
> +            if (s->sid_split != 6 && s->sid_split != 8 && s->sid_split != 
> 10) {
> +                /* Other values are reserved, behave as 6 */
> +                qemu_log_mask(LOG_GUEST_ERROR,
> +                              "Invalid STRTAB_BASE_CFG.SPLIT=0x%b, use 
> 0b0110\n",
> +                              s->sid_split);

0x%b is confusing. I think either 0b%b or %u is better.

Other than that,

Reviewed-by: Shameer Kolothum <[email protected]>

Thanks,
Shameer

Reply via email to