public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH rc v7 0/6] iommu: Fix pci_dev_reset_iommu_prepare/done()
@ 2026-04-18 23:41 Nicolin Chen
  2026-04-18 23:41 ` [PATCH rc v7 1/6] iommu: Fix kdocs of pci_dev_reset_iommu_done() Nicolin Chen
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Nicolin Chen @ 2026-04-18 23:41 UTC (permalink / raw)
  To: joro, kevin.tian, jgg
  Cc: will, robin.murphy, baolu.lu, iommu, linux-kernel, xueshuai

Shuai and Kevin found a few bugs in the pci_dev_reset_iommu_prepare/done()
helpers when used to handle some corner cases:
 - Nested callbacks
 - Multi-device groups
 - UAF due to concurrent detach

This needs some substantial rework by tracking device reset states on a per
gdev basis. This series includes a few patches addressing them. Most of the
patches are reviewed previously in a single patch v6. As we found more bugs
during the reviews, I split that v6 to smaller patches so each of them will
be cleaner. IOW, the git-diff from PATCH 1-4 is identical to v6.

This is on Github:
https://github.com/nicolinc/iommufd/commits/fix_iommu_reset-v7

Changelog
 v7:
  * Add Reviewed-by tags
  * Split v6 into smaller patches
  * Add one patch to fix UAF during detach()
  * Add one patch to fix unnecessary ATS invalidation
 v6:
  https://lore.kernel.org/all/20260407194644.171304-1-nicolinc@nvidia.com/
  * Update inline comments and commit message
  * Add "max_pasids > 0" condition in both helpers
 v5:
  https://lore.kernel.org/all/20260404050243.141366-1-nicolinc@nvidia.com/
  * Add 'blocked' to fix iommu_driver_get_domain_for_dev() return.
 v4:
  https://lore.kernel.org/all/20260324014056.36103-1-nicolinc@nvidia.com/
  * Rename 'reset_cnt' to 'recovery_cnt'
 v3:
  https://lore.kernel.org/all/20260321223930.10836-1-nicolinc@nvidia.com/
  * Turn prepare()/done() to be per-gdev
  * Use reset_depth to track nested re-entries
  * Replace group->resetting_domain with a reset_cnt
 v2:
  https://lore.kernel.org/all/20260319043135.1153534-1-nicolinc@nvidia.com/
  * Fix in the helpers by allowing re-entry
 v1:
  https://lore.kernel.org/all/20260318220028.1146905-1-nicolinc@nvidia.com/

Nicolin Chen (6):
  iommu: Fix kdocs of pci_dev_reset_iommu_done()
  iommu: Replace per-group resetting_domain with per-gdev blocked flag
  iommu: Fix pasid attach in pci_dev_reset_iommu_prepare/done()
  iommu: Fix nested pci_dev_reset_iommu_prepare/done()
  iommu: Fix ATS invalidation timeouts during
    __iommu_remove_group_pasid()
  iommu: Fix UAF in pci_dev_reset_iommu_done() due to concurrent detach

 drivers/iommu/iommu.c | 163 ++++++++++++++++++++++++++++++++----------
 1 file changed, 124 insertions(+), 39 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-04-21 18:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-18 23:41 [PATCH rc v7 0/6] iommu: Fix pci_dev_reset_iommu_prepare/done() Nicolin Chen
2026-04-18 23:41 ` [PATCH rc v7 1/6] iommu: Fix kdocs of pci_dev_reset_iommu_done() Nicolin Chen
2026-04-18 23:41 ` [PATCH rc v7 2/6] iommu: Replace per-group resetting_domain with per-gdev blocked flag Nicolin Chen
2026-04-18 23:41 ` [PATCH rc v7 3/6] iommu: Fix pasid attach in pci_dev_reset_iommu_prepare/done() Nicolin Chen
2026-04-18 23:41 ` [PATCH rc v7 4/6] iommu: Fix nested pci_dev_reset_iommu_prepare/done() Nicolin Chen
2026-04-18 23:41 ` [PATCH rc v7 5/6] iommu: Fix ATS invalidation timeouts during __iommu_remove_group_pasid() Nicolin Chen
2026-04-21  7:15   ` Tian, Kevin
2026-04-21 17:57     ` Nicolin Chen
2026-04-18 23:41 ` [PATCH rc v7 6/6] iommu: Fix UAF in pci_dev_reset_iommu_done() due to concurrent detach Nicolin Chen
2026-04-21  7:41   ` Tian, Kevin
2026-04-21 18:10     ` Nicolin Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox