linux/tools/testing/selftests/iommu
Jason Gunthorpe 996dc53ac2 iommufd: Do not allow creating areas without READ or WRITE
This results in passing 0 or just IOMMU_CACHE to iommu_map(). Most of
the page table formats don't like this:

  amdv1 - -EINVAL
  armv7s - returns 0, doesn't update mapped
  arm-lpae - returns 0 doesn't update mapped
  dart - returns 0, doesn't update mapped
  VT-D - returns -EINVAL

Unfortunately the three formats that return 0 cause serious problems:

 - Returning ret = but not uppdating mapped from domain->map_pages()
   causes an infinite loop in __iommu_map()

 - Not writing ioptes means that VFIO/iommufd have no way to recover them
   and we will have memory leaks and worse during unmap

Since almost nothing can support this, and it is a useless thing to do,
block it early in iommufd.

Cc: stable@kernel.org
Fixes: aad37e71d5 ("iommufd: IOCTLs for the io_pagetable")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/1-v1-1211e1294c27+4b1-iommu_no_prot_jgg@nvidia.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-08-26 09:16:13 +02:00
..
.gitignore
config iommufd: Add config needed for iommufd_fail_nth 2024-04-14 13:52:08 -03:00
iommufd.c iommufd: Do not allow creating areas without READ or WRITE 2024-08-26 09:16:13 +02:00
iommufd_fail_nth.c iommufd/selftest: Add coverage for IOPF test 2024-07-09 13:54:32 -03:00
iommufd_utils.h Merge branch 'iommufd_pri' into iommufd for-next 2024-07-09 13:55:05 -03:00
Makefile selftests: centralize -D_GNU_SOURCE= to CFLAGS in lib.mk 2024-07-10 12:14:51 -07:00