From: Jason Gunthorpe <jgg@ziepe.ca>
To: Peiyang He <peiyang_he@smail.nju.edu.cn>
Cc: kevin.tian@intel.com, joro@8bytes.org, will@kernel.org,
iommu@lists.linux.dev, robin.murphy@arm.com,
linux-kernel@vger.kernel.org, syzkaller@googlegroups.com,
stable@vger.kernel.org
Subject: Re: [PATCH] iommufd: Reject DMABUF pages from the access pin path
Date: Mon, 13 Jul 2026 14:28:36 -0300 [thread overview]
Message-ID: <20260713172836.GG3133966@ziepe.ca> (raw)
In-Reply-To: <CD68F549BF3761B7+20260709050800.520607-1-peiyang_he@smail.nju.edu.cn>
On Thu, Jul 09, 2026 at 01:08:00PM +0800, Peiyang He wrote:
> DMABUF pages are not supported for iommufd access pinning.
> iommufd_access_pin_pages() returns struct page pointers for
> in-kernel CPU access, but DMABUF-backed iopt_pages do not carry
> a userspace address that can be passed to the GUP path.
>
> iopt_pages_rw_access() already rejects IOPT_ADDRESS_DMABUF before doing
> CPU access. Apply the same rejection to iopt_area_add_access() before it
> takes pages->mutex and calls iopt_pages_fill_xarray().
> Otherwise a DMABUF-backed iopt_pages can reach the hole-fill path, where
> pfn_reader_user_pin() interprets the union as uptr and
> calls pin_user_pages_fast()/pin_user_pages_remote().
>
> This fix also avoids the lockdep warning reported from that path, where
> pages_dmabuf_mutex_key is held while gup_fast_fallback() may acquire
> mmap_lock.
>
> Reported-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
> Closes: https://lore.kernel.org/all/E8540D7D05768C91+8b2ef227-3368-494e-909d-7b28e1489dfb@smail.nju.edu.cn/
> Fixes: 71db84a092c3 ("iommufd: Add DMABUF to iopt_pages")
> Cc: stable@vger.kernel.org
> Tested-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
> Signed-off-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
> ---
> drivers/iommu/iommufd/pages.c | 3 +++
> 1 file changed, 3 insertions(+)
Applied thanks
Jason
prev parent reply other threads:[~2026-07-13 17:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 10:44 [BUG] iommufd: dma-buf-backed iopt_pages wrongly reaches userspace GUP path and triggers lockdep warning Peiyang He
2026-07-08 14:36 ` Jason Gunthorpe
2026-07-09 2:58 ` Peiyang He
2026-07-09 5:08 ` [PATCH] iommufd: Reject DMABUF pages from the access pin path Peiyang He
2026-07-13 6:10 ` Tian, Kevin
2026-07-13 8:59 ` Peiyang He
2026-07-13 17:28 ` Jason Gunthorpe [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=20260713172836.GG3133966@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peiyang_he@smail.nju.edu.cn \
--cc=robin.murphy@arm.com \
--cc=stable@vger.kernel.org \
--cc=syzkaller@googlegroups.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