From: Jason Gunthorpe <jgg@ziepe.ca>
To: Peiyang He <peiyang_he@smail.nju.edu.cn>
Cc: joro@8bytes.org, will@kernel.org, kevin.tian@intel.com,
robin.murphy@arm.com, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org, baolu.lu@linux.intel.com,
stable@vger.kernel.org
Subject: Re: [PATCH v3 1/2] iommu/iommufd: Fix IOPF group ownership UAF
Date: Sun, 26 Jul 2026 13:20:49 -0300 [thread overview]
Message-ID: <amYz4X2N8bD0eZj1@ziepe.ca> (raw)
In-Reply-To: <3CFD314D0FE4D7EC+20260720085017.3998878-2-peiyang_he@smail.nju.edu.cn>
On Mon, Jul 20, 2026 at 04:50:16PM +0800, Peiyang He wrote:
> iopf_group_alloc() links each last-page IOPF group into the generic IOPF
> pending list before invoking the domain fault handler.
> iommufd_fault_iopf_handler() also queued an accepted group in the
> IOMMUFD deliver list without removing it from the generic pending list.
>
> When detach or HWPT replacement drops the device's IOPF reference count
> to zero, an IOMMU driver may call iopf_queue_remove_device(). That
> function responds to and frees groups through the generic pending list
> without removing the same groups from IOMMUFD's deliver list or response
> xarray. A later read, response, or cleanup can then access the freed
> group and cause a UAF.
>
> Fix this by dequeuing an accepted group from the generic pending list
> before IOMMUFD queues it for userspace response.
> Make iopf_group_response() send a response regardless of pending-list
> membership, so the dequeued group can still be completed by IOMMUFD.
>
> Closes: https://lore.kernel.org/all/B4F28798E2E784CA+d29f723c-b2b5-4b67-8d1c-4f7b9b0b27cb@smail.nju.edu.cn/
> Fixes: 34765cbc679c ("iommufd: Associate fault object with iommufd_hw_pgtable")
> Cc: stable@vger.kernel.org
> Tested-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
> Assisted-by: Codex:gpt-5.6-sol
> Signed-off-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
> ---
> drivers/iommu/io-pgfault.c | 24 +++++++++++++++++++-----
> drivers/iommu/iommufd/eventq.c | 2 ++
> include/linux/iommu.h | 5 +++++
> 3 files changed, 26 insertions(+), 5 deletions(-)
Applied to for-rc
Thanks,
Jason
next prev parent reply other threads:[~2026-07-26 16:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 6:12 [BUG] iommu: KASAN slab-use-after-free in iommufd_auto_response_faults Peiyang He
2026-07-07 10:36 ` Peiyang He
2026-07-08 14:38 ` Ankit Soni
2026-07-13 6:10 ` Tian, Kevin
2026-07-13 9:01 ` Peiyang He
2026-07-15 4:24 ` [PATCH] iommu/iommufd: Fix IOPF group ownership UAF Peiyang He
2026-07-17 8:00 ` Tian, Kevin
2026-07-18 4:55 ` Peiyang He
2026-07-18 4:32 ` [PATCH v2] " Peiyang He
2026-07-20 5:13 ` Tian, Kevin
2026-07-20 8:50 ` [PATCH v3 0/2] " Peiyang He
2026-07-26 12:43 ` Will Deacon
2026-07-26 16:15 ` Jason Gunthorpe
[not found] ` <20260720085017.3998878-1-peiyang_he@smail.nju.edu.cn>
2026-07-20 8:50 ` [PATCH v3 1/2] " Peiyang He
2026-07-20 9:44 ` Tian, Kevin
2026-07-26 16:20 ` Jason Gunthorpe [this message]
2026-07-20 8:50 ` [PATCH v3 2/2] iommu: Make iopf_group_response() free groups Peiyang He
2026-07-20 9:44 ` Tian, Kevin
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=amYz4X2N8bD0eZj1@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=baolu.lu@linux.intel.com \
--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=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
all inboxes | Powered by JetHome®