linux/drivers/iommu/iommufd
Joao Martins 2e22aac3ea iommufd/selftest: Fix page-size check in iommufd_test_dirty()
iommufd_test_dirty()/IOMMU_TEST_OP_DIRTY sets the dirty bits in the mock
domain implementation that the userspace side validates against what it
obtains via the UAPI.

However in introducing iommufd_test_dirty() it forgot to validate page_size
being 0 leading to two possible divide-by-zero problems: one at the
beginning when calculating @max and while calculating the IOVA in the
XArray PFN tracking list.

While at it, validate the length to require non-zero value as well, as we
can't be allocating a 0-sized bitmap.

Link: https://lore.kernel.org/r/20231030113446.7056-1-joao.m.martins@oracle.com
Reported-by: syzbot+25dc7383c30ecdc83c38@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-iommu/00000000000005f6aa0608b9220f@google.com/
Fixes: a9af47e382 ("iommufd/selftest: Test IOMMU_HWPT_GET_DIRTY_BITMAP")
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2023-10-30 12:03:20 -03:00
..
device.c iommufd: Add a nested HW pagetable object 2023-10-26 11:15:57 -03:00
double_span.h
hw_pagetable.c iommufd: Add a nested HW pagetable object 2023-10-26 11:15:57 -03:00
io_pagetable.c iommufd: Add iopt_area_alloc() 2023-10-30 11:36:04 -03:00
io_pagetable.h
ioas.c iommu/iommufd: Pass iommufd_ctx pointer in iommufd_get_ioas() 2023-03-29 16:52:41 -03:00
iommufd_private.h iommufd: Add a nested HW pagetable object 2023-10-26 11:15:57 -03:00
iommufd_test.h iommufd/selftest: Add nested domain allocation for mock domain 2023-10-26 11:15:57 -03:00
iova_bitmap.c iommufd/iova_bitmap: Move symbols to IOMMUFD namespace 2023-10-24 11:58:42 -03:00
Kconfig vfio: Compile vfio_group infrastructure optionally 2023-07-25 10:20:50 -06:00
main.c iommufd: Add a nested HW pagetable object 2023-10-26 11:15:57 -03:00
Makefile vfio: Move iova_bitmap into iommufd 2023-10-24 11:58:42 -03:00
pages.c iommufd: Add iopt_area_alloc() 2023-10-30 11:36:04 -03:00
selftest.c iommufd/selftest: Fix page-size check in iommufd_test_dirty() 2023-10-30 12:03:20 -03:00
vfio_compat.c iommufd: Derive iommufd_hwpt_paging from iommufd_hw_pagetable 2023-10-26 11:15:56 -03:00