]> git.ipfire.org Git - thirdparty/qemu.git/commit
vfio: Remove workaround for kernel DMA unmap overflow bug
authorCédric Le Goater <clg@redhat.com>
Fri, 26 Sep 2025 08:54:23 +0000 (10:54 +0200)
committerCédric Le Goater <clg@redhat.com>
Thu, 2 Oct 2025 08:41:23 +0000 (10:41 +0200)
commit1d9a832b58be63e53ef0d2342c271a34ecb349db
tree7c84630c785df68c18cb0f408529c2cf855f92c8
parent29b77c1a2db2d796bc3847852a5c8dc2a1e6e83b
vfio: Remove workaround for kernel DMA unmap overflow bug

A kernel bug was introduced in Linux v4.15 via commit 71a7d3d78e3c
("vfio/type1: Check for address space wrap-around on unmap"), which
added a test for address space wrap-around in the vfio DMA unmap path.
Unfortunately, due to an integer overflow, the kernel would
incorrectly detect an unmap of the last page in the 64-bit address
space as a wrap-around, causing the unmap to fail with -EINVAL.

A QEMU workaround was introduced in commit 567d7d3e6be5 ("vfio/common:
Work around kernel overflow bug in DMA unmap") to retry the unmap,
excluding the final page of the range.

The kernel bug was then fixed in Linux v5.0 via commit 58fec830fc19
("vfio/type1: Fix dma_unmap wrap-around check"). Since the oldest
supported LTS kernel is now v5.4, kernels affected by this bug are
considered deprecated, and the workaround is no longer necessary.

This change reverts 567d7d3e6be5, removing the workaround.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1662291
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Link: https://lore.kernel.org/qemu-devel/20250926085423.375547-1-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
hw/vfio/container-legacy.c
hw/vfio/trace-events