From: Balbir Singh <balbirs@nvidia.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
Jean-Philippe Brucker <jean-philippe@linaro.org>,
Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Joerg Roedel <joro@8bytes.org>
Subject: Re: [PATCH] iommu/arm-smmu-v3: Fix pgsize_bit for sva domains
Date: Wed, 16 Apr 2025 09:49:58 +1000 [thread overview]
Message-ID: <90788e4d-e92f-4b32-9103-f4c528bec026@nvidia.com> (raw)
In-Reply-To: <20250415131053.GB517881@nvidia.com>
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@nvidia.com>
>> Signed-off-by: Balbir Singh <balbirs@nvidia.com>
>>
>> Cc: Jean-Philippe Brucker <jean-philippe@linaro.org>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Robin Murphy <robin.murphy@arm.com>
>> Cc: Joerg Roedel <joro@8bytes.org>
>> Cc: Jason Gunthorpe <jgg@ziepe.ca>
>>
>> ---
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.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
next prev parent reply other threads:[~2025-04-15 23:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-12 0:23 [PATCH] iommu/arm-smmu-v3: Fix pgsize_bit for sva domains Balbir Singh
2025-04-15 13:10 ` Jason Gunthorpe
2025-04-15 23:49 ` Balbir Singh [this message]
2025-04-17 14:27 ` Will Deacon
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=90788e4d-e92f-4b32-9103-f4c528bec026@nvidia.com \
--to=balbirs@nvidia.com \
--cc=iommu@lists.linux.dev \
--cc=jean-philippe@linaro.org \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/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