From: sashiko-bot@kernel.org
To: "Nicolin Chen" <nicolinc@nvidia.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 04/13] iommu/arm-smmu-v3: Flush in-flight fault work on domain detach
Date: Tue, 01 Sep 2026 00:55:22 +0000 [thread overview]
Message-ID: <20260901005523.68DDA1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <45b6e8c6dab5b67a91ba54c32bf11ab3347d80f5.1788222485.git.nicolinc@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] Pre-existing UAF on the IOMMU core domain during a race window between IOPF queue flush and IOMMU core handle update.
--
commit fe39d3d0018e082fcdaca3fbd4d2a4bd526c0f92
Author: Nicolin Chen <nicolinc@nvidia.com>
iommu/arm-smmu-v3: Flush in-flight fault work on domain detach
This commit adds synchronization and flushing of the IOPF queue during domain
detach. It ensures that all in-flight stall events and fault work are handled
or safely leaked in case of timeouts.
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index d255ff2519f9d..1851ee7ec15b9 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -3412,8 +3413,40 @@ void arm_smmu_attach_release(struct arm_smmu_attach_state *state)
[ ... ]
> + /*
> + * Only IOPF-enabled attachments queue fault work, and such work
> + * references the old domain via its attach handle. Flush it, as
> + * the IOMMU core might free the old domain once this returns.
> + */
> + if (master_domain->using_iopf) {
> + /* Lastly, drain the IOPF queue */
> + iopf_queue_flush_dev(master->dev);
[Severity: Critical]
This is a pre-existing issue, but does flushing the IOPF queue here leave a
race window open for new faults to be resolved to the old domain before the
function returns and the IOMMU core updates the attach handle?
During a domain transition, the hardware is reconfigured to the new domain,
and arm_smmu_attach_release() calls iopf_queue_flush_dev(). If the device
immediately generates a new fault, the EVTQ IRQ thread reads it and calls
iommu_report_device_fault().
Because the IOMMU core only updates the attach handle after the driver's
operation returns, the new fault is incorrectly resolved to the old domain's
handle and queued as fault work.
The IOMMU core then frees the old domain, and the queued work executes,
dereferencing the freed domain via
group->attach_handle->domain->iopf_handler(group).
Can this result in a Use-After-Free of the iommu_domain structure by an
untrusted guest or device generating faults immediately after a domain
transition?
> +
> + /*
> + * A timed-out drain may leave fault work in flight, and
> + * iopf_queue_remove_device() would free iopf groups that
> + * such work still references. Skip the iopf teardown and
> + * leak master_domain, rather than risk a UAF.
> + */
> + if (WARN_ON(ret)) {
> + state->old_master_domain = NULL;
> + return;
> + }
> + }
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1788222485.git.nicolinc@nvidia.com?part=4
next prev parent reply other threads:[~2026-09-01 0:55 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 0:33 [PATCH v3 00/13] iommu/arm-smmu-v3: Add PRI support Nicolin Chen
2026-09-01 0:33 ` [PATCH v3 01/13] iommu/arm-smmu-v3: Add arm_smmu_attach_release() Nicolin Chen
2026-09-01 0:46 ` sashiko-bot
2026-09-03 19:18 ` Jonathan Cameron
2026-09-04 20:16 ` Nicolin Chen
2026-09-01 0:33 ` [PATCH v3 02/13] iommu/arm-smmu-v3: Add Q_POS() macro Nicolin Chen
2026-09-01 0:38 ` sashiko-bot
2026-09-01 0:33 ` [PATCH v3 03/13] iommu/arm-smmu-v3: Drain in-flight fault events on domain detach Nicolin Chen
2026-09-01 0:48 ` sashiko-bot
2026-09-03 19:18 ` Jonathan Cameron
2026-09-04 14:09 ` Jason Gunthorpe
2026-09-04 22:57 ` Nicolin Chen
2026-09-08 16:36 ` Jason Gunthorpe
2026-09-08 21:01 ` Nicolin Chen
2026-09-04 21:42 ` Nicolin Chen
2026-09-01 0:33 ` [PATCH v3 04/13] iommu/arm-smmu-v3: Flush in-flight fault work " Nicolin Chen
2026-09-01 0:55 ` sashiko-bot [this message]
2026-09-03 19:18 ` Jonathan Cameron
2026-09-05 0:54 ` Nicolin Chen
2026-09-01 0:33 ` [PATCH v3 05/13] iommu/arm-smmu-v3: Allocate IOPF queue without FEAT_SVA Nicolin Chen
2026-09-01 0:46 ` sashiko-bot
2026-09-03 19:18 ` Jonathan Cameron
2026-09-01 0:33 ` [PATCH v3 06/13] iommu/arm-smmu-v3: Submit CMDQ_OP_PRI_RESP for IOPF event Nicolin Chen
2026-09-01 0:53 ` sashiko-bot
2026-09-03 19:18 ` Jonathan Cameron
2026-09-05 1:15 ` Nicolin Chen
2026-09-09 17:54 ` Jonathan Cameron
2026-09-01 0:33 ` [PATCH v3 07/13] iommu/arm-smmu-v3: Disable the queue IRQs before disabling the SMMU Nicolin Chen
2026-09-01 0:55 ` sashiko-bot
2026-09-03 19:18 ` Jonathan Cameron
2026-09-05 3:24 ` Nicolin Chen
2026-09-09 17:58 ` Jonathan Cameron
2026-09-01 0:33 ` [PATCH v3 08/13] iommu/arm-smmu-v3: Disable PRI when no IRQ handler is registered Nicolin Chen
2026-09-01 0:47 ` sashiko-bot
2026-09-03 19:18 ` Jonathan Cameron
2026-09-04 14:15 ` Jason Gunthorpe
2026-09-09 17:59 ` Jonathan Cameron
2026-09-09 19:05 ` Nicolin Chen
2026-09-01 0:33 ` [PATCH v3 09/13] iommu/arm-smmu-v3: Support PRI Page Request in arm_smmu_handle_ppr() Nicolin Chen
2026-09-01 0:50 ` sashiko-bot
2026-09-03 19:18 ` Jonathan Cameron
2026-09-05 5:08 ` Nicolin Chen
2026-09-09 18:01 ` Jonathan Cameron
2026-09-09 19:09 ` Nicolin Chen
2026-09-01 0:33 ` [PATCH v3 10/13] iommu/arm-smmu-v3: Allocate IOPF queue for ARM_SMMU_FEAT_PRI Nicolin Chen
2026-09-01 0:43 ` sashiko-bot
2026-09-03 19:18 ` Jonathan Cameron
2026-09-01 0:33 ` [PATCH v3 11/13] PCI/ATS: Add PRI stubs Nicolin Chen
2026-09-01 0:42 ` sashiko-bot
2026-09-03 19:18 ` Jonathan Cameron
2026-09-01 0:33 ` [PATCH v3 12/13] PCI/ATS: Export pci_enable_pri() and pci_reset_pri() Nicolin Chen
2026-09-01 0:44 ` sashiko-bot
2026-09-03 19:18 ` Jonathan Cameron
2026-09-01 0:33 ` [PATCH v3 13/13] iommu/arm-smmu-v3: Enable PRI for PCI device in arm_smmu_probe_device() Nicolin Chen
2026-09-01 0:51 ` sashiko-bot
2026-09-03 19:18 ` Jonathan Cameron
2026-09-05 5:53 ` Nicolin Chen
2026-09-03 19:18 ` [PATCH v3 00/13] iommu/arm-smmu-v3: Add PRI support Jonathan Cameron
2026-09-04 14:10 ` Jason Gunthorpe
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=20260901005523.68DDA1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=nicolinc@nvidia.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.