From: Samiullah Khawaja <skhawaja@google.com>
To: James Widner <jameswidner2@gmail.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>, Kevin Tian <kevin.tian@intel.com>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
iommu@lists.linux.dev, stable@vger.kernel.org
Subject: Re: [PATCH] iommufd: avoid unsigned wrap at the top of the address space
Date: Wed, 2 Dec 2026 18:25:34 +0000 [thread overview]
Message-ID: <axBcRoKGAAGt0HVl@google.com> (raw)
In-Reply-To: <20261202131400.2295591-1-jameswidner2@gmail.com>
On Wed, Dec 02, 2026 at 01:14:00PM +0000, James Widner wrote:
>batch_to_domain() computes a PFN run's exclusive IOVA end using
>last_iova + 1 even though last_iova is the inclusive area end. When an
>area ends at ULONG_MAX this wraps to zero. The first PFN run can then be
>extended over the remaining area while later runs are submitted with a
>zero length. On paths that accept the zero-length continuation, the map
>succeeds with translations that do not match the pinned PFN runs.
>
>Teardown reads PFNs back from the domain. It may consequently put the
>unintended page installed by the extended first run while retaining the
>pin on the intended later page.
>
>Compute each run size from the remaining inclusive distance instead. Stop
>after mapping the terminal byte so the IOVA cursor is never advanced past
>ULONG_MAX.
>
>The final change passed an instrumented current-source mock-domain A/B. A
>semantically equivalent Linux 6.12 backport passed a separate emulated
>device-DMA A/B. One million randomized arithmetic-model cases also passed.
>
>This finding, its tests, this fix, and this changelog were prepared with
>substantial assistance from language-model-based coding tools.
>
>Fixes: f394576eb11d ("iommufd: PFN handling for iopt_pages")
>Cc: stable@vger.kernel.org
>Signed-off-by: James Widner <jameswidner2@gmail.com>
>---
> drivers/iommu/iommufd/pages.c | 20 +++++++++++---------
> 1 file changed, 11 insertions(+), 9 deletions(-)
>
Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
Tested-by: Samiullah Khawaja <skhawaja@google.com>
Thanks,
Sami
prev parent reply other threads:[~2026-12-02 18:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <aw-G094ik8fz3XSO@google.com>
2026-12-02 13:14 ` [PATCH] iommufd: avoid unsigned wrap at the top of the address space James Widner
2026-12-02 18:25 ` Samiullah Khawaja [this message]
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=axBcRoKGAAGt0HVl@google.com \
--to=skhawaja@google.com \
--cc=iommu@lists.linux.dev \
--cc=jameswidner2@gmail.com \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=robin.murphy@arm.com \
--cc=stable@vger.kernel.org \
--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