[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <90788e4d-e92f-4b32-9103-f4c528bec026@nvidia.com>
Date: Wed, 16 Apr 2025 09:49:58 +1000
From: Balbir Singh <balbirs@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
Joerg Roedel <joro@...tes.org>
Subject: Re: [PATCH] iommu/arm-smmu-v3: Fix pgsize_bit for sva domains
On 4/15/25 23:10, Jason Gunthorpe wrote:
> On Sat, Apr 12, 2025 at 10:23:54AM +1000, Balbir Singh wrote:
>> UBSan caught a bug with IOMMU SVA domains, where the reported exponent
>> value in __arm_smmu_tlb_inv_range() was >= 64.
>> __arm_smmu_tlb_inv_range() uses the domain's pgsize_bitmap to compute
>> the number of pages to invalidate and the invalidation range. Currently
>> arm_smmu_sva_domain_alloc() does not setup the iommu domain's
>> pgsize_bitmap. This leads to __ffs() on the value returning 64 and that
>> leads to undefined behaviour w.r.t. shift operations
>>
>> Fix this by initializing the iommu_domain's pgsize_bitmap to PAGE_SIZE.
>> Effectively the code needs to use the smallest page size for
>> invalidation
>>
>> Fixes: eb6c97647be2 ("iommu/arm-smmu-v3: Avoid constructing invalid range commands")
>> Suggested-by: Jason Gunthorpe <jgg@...dia.com>
>> Signed-off-by: Balbir Singh <balbirs@...dia.com>
>>
>> Cc: Jean-Philippe Brucker <jean-philippe@...aro.org>
>> Cc: Will Deacon <will@...nel.org>
>> Cc: Robin Murphy <robin.murphy@....com>
>> Cc: Joerg Roedel <joro@...tes.org>
>> Cc: Jason Gunthorpe <jgg@...pe.ca>
>>
>> ---
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>
> Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
>
> This should go to rc
>
Thanks Jason! I was wondering if I should add a cc: stable, I think that it's
a simple enough fix to backport, but I would also like maintainer(s) inputs as well
Balbir Singh
Powered by blists - more mailing lists