Skip to content

iommufd: Fix bugs in eventq fops_read paths

Nicolin Chen linux-iommu linux-kselftest lkml 1 version Applied

Status from this message: Applied to for-next

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 10 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/7iommufd: Rewind header length in done if iommufd_veventq_fops_read() failsdrivers/iommu/iommufd/eventq.c+1 -01 reply
2/7iommufd: Reject invalid read count in iommufd_veventq_fops_read()drivers/iommu/iommufd/eventq.c+6 -01 reply
3/7iommufd: Propagate allocation failure in iommufd_veventq_deliver_fetch()drivers/iommu/iommufd/eventq.c+9 -11 reply
4/7iommufd: Reject invalid read count in iommufd_fault_fops_read()drivers/iommu/iommufd/eventq.c+3 -01 reply
5/7iommufd: Break the loop on failure in iommufd_fault_fops_read()drivers/iommu/iommufd/eventq.c+2 -01 reply
6/7iommufd: Avoid partial fault group delivery in iommufd_fault_fops_read()drivers/iommu/iommufd/eventq.c+5 -21 reply
7/7iommufd/selftest: Cover invalid read counts on vEVENTQ FDtools/testing/selftests/iommu/iommufd.c+17 -01 reply

Reviews trailers per patch

All 7 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchKevin TianPranjal Shrivastava
SeriesR-b
1/7R-b
2/7R-b
3/7R-b
4/7R-b
5/7R-b
6/7R-b
7/7R-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 v1 0/7] iommufd: Fix bugs in eventq fops_read paths

Bugs were found in iommufd_veventq/fault_fops_read(), where userspace may:
- Receive a corrupted byte stream after a partial copy_to_user
- Spin in a poll/read loop when reading with an undersized buffer
- Miss notifications when the kernel cannot allocate a lost-events copy
- Receive duplicate faults with stale cookies after a mid-group failure
- Cause the kernel to retry the same failed copy_to_user indefinitely

Fix them, then add selftest coverage for the vEVENTQ count validation.

This is on github:
https://github.com/nicolinc/iommufd/commits/fix_eventq_read_bugs-v1

Rebased on Jason's for-next tree with the veventq_depth series applied.

Nicolin Chen (7):
iommufd: Rewind header length in done if iommufd_veventq_fops_read()
fails
iommufd: Reject invalid read count in iommufd_veventq_fops_read()
iommufd: Propagate allocation failure in
iommufd_veventq_deliver_fetch()
iommufd: Reject invalid read count in iommufd_fault_fops_read()
iommufd: Break the loop on failure in iommufd_fault_fops_read()
iommufd: Avoid partial fault group delivery in
iommufd_fault_fops_read()
iommufd/selftest: Cover invalid read counts on vEVENTQ FD

 drivers/iommu/iommufd/eventq.c          | 29 ++++++++++++++++++++++---
 tools/testing/selftests/iommu/iommufd.c | 17 +++++++++++++++
 2 files changed, 43 insertions(+), 3 deletions(-)

base-commit: f25989c19028e8bf81e26e1133a99e3436c3afc2

Signature · 1 line
2.43.0