Skip to content

iommu/vt-d: Fix SVA teardown races with process exit

Lu Baolu linux-iommu lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2iommu/vt-d: Set FPD when tearing down a PASID entry with fault_ignoredrivers/iommu/intel/pasid.c drivers/iommu/intel/pasid.h+21 -184 replies
2/2iommu/vt-d: Serialize SVA unbind teardown with intel_mm_release()drivers/iommu/intel/iommu.c drivers/iommu/intel/pasid.c+11 -11 reply

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchKevin Tian
1/2
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] iommu/vt-d: Fix SVA teardown races with process exit

When a process using SVA exits while a device still has DMA and page requests in flight for its PASID, the Intel IOMMU driver can mishandle the teardown of that PASID. This series aims to fix two such issues.

The first is a use-after-free in the iopf handling path. After the process exits, the later SVA unbind no longer drains the page request queue for the PASID before the SVA attach handle is freed. Page requests queued before the exit are then handled by iommu_sva_handle_iopf() on the freed handle.

The second is a race between process exit and an SVA unbind of the PASID. The mm release callback can return before the unbind completes invalidating the PASID cache, IOTLB and device TLB. The exiting process may then free its page tables while the IOMMU and the device still hold translations that reference them.

Please review and comments.

Lu Baolu (2):
iommu/vt-d: Set FPD when tearing down a PASID entry with fault_ignore iommu/vt-d: Serialize SVA unbind teardown with intel_mm_release()

 drivers/iommu/intel/pasid.h | 11 +++++++++++
 drivers/iommu/intel/iommu.c | 10 ++++++++++
 drivers/iommu/intel/pasid.c | 30 +++++++++++-------------------
 3 files changed, 32 insertions(+), 19 deletions(-)
Signature · 1 line
2.43.0