[PATCH 0/2] vfio: selftests: Fix MMIO test failures in iommufd compat mode

Yi Lai posted 2 patches 2 weeks, 1 day ago
.../selftests/vfio/vfio_dma_mapping_mmio_test.c        | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
[PATCH 0/2] vfio: selftests: Fix MMIO test failures in iommufd compat mode
Posted by Yi Lai 2 weeks, 1 day ago
This series fixes two issues in the vfio_dma_mapping_mmio_test selftest when
running in iommufd compat mode.

The first patch fixes a segmentation fault caused by an uninitialized list head
when __iommu_map() fails (as expected for MMIO regions in iommufd).

The second patch fixes a test assertion failure by aligning the check for the
__iommu_unmap() return value based on the iommufd mode (native vs. compat).

Yi Lai (2):
  vfio: selftests: Fix iommufd compat mode __iommu_unmap() crash
  vfio: selftests: Align __iommu_unmap() check with iommufd compat mode

 .../selftests/vfio/vfio_dma_mapping_mmio_test.c        | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
2.43.0
Re: [PATCH 0/2] vfio: selftests: Fix MMIO test failures in iommufd compat mode
Posted by David Matlack 2 weeks ago
On Thu, Mar 19, 2026 at 9:03 PM Yi Lai <yi1.lai@intel.com> wrote:
>
> This series fixes two issues in the vfio_dma_mapping_mmio_test selftest when
> running in iommufd compat mode.
>
> The first patch fixes a segmentation fault caused by an uninitialized list head
> when __iommu_map() fails (as expected for MMIO regions in iommufd).
>
> The second patch fixes a test assertion failure by aligning the check for the
> __iommu_unmap() return value based on the iommufd mode (native vs. compat).

Alex Mastro also sent a fix for these issues here:

  https://lore.kernel.org/kvm/20260303-fix-mmio-test-v1-1-78b4a9e46a4e@fb.com/

Can you take a look and see if it looks ok to you? I think I prefer
Alex's fix. We shouldn't even be calling __iommu_unmap() after
__iommu_map() fails.
Re: [PATCH 0/2] vfio: selftests: Fix MMIO test failures in iommufd compat mode
Posted by Lai, Yi 1 week, 5 days ago
On Fri, Mar 20, 2026 at 10:43:54AM -0700, David Matlack wrote:
> On Thu, Mar 19, 2026 at 9:03 PM Yi Lai <yi1.lai@intel.com> wrote:
> >
> > This series fixes two issues in the vfio_dma_mapping_mmio_test selftest when
> > running in iommufd compat mode.
> >
> > The first patch fixes a segmentation fault caused by an uninitialized list head
> > when __iommu_map() fails (as expected for MMIO regions in iommufd).
> >
> > The second patch fixes a test assertion failure by aligning the check for the
> > __iommu_unmap() return value based on the iommufd mode (native vs. compat).
> 
> Alex Mastro also sent a fix for these issues here:
> 
>   https://lore.kernel.org/kvm/20260303-fix-mmio-test-v1-1-78b4a9e46a4e@fb.com/
> 
> Can you take a look and see if it looks ok to you? I think I prefer
> Alex's fix. We shouldn't even be calling __iommu_unmap() after
> __iommu_map() fails.

Yes, just remove calling __iommu_unmap() is a more direct fix for the
two issues I encoutered. Agree with the fix.