vfio: Don't issue full 2^64 unmap
authorJean-Philippe Brucker <jean-philippe@linaro.org>
Fri, 30 Oct 2020 18:05:10 +0000 (19:05 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 3 Nov 2020 21:39:05 +0000 (16:39 -0500)
commit1b296c3def4b9b63d2fdbce6646edd108a3e616c
tree4641ac050f0430c0018bac7c1e1d6998d57f6cc3
parent5c3cfe33f4185841feaedd07bea1d6d7e02011a0
vfio: Don't issue full 2^64 unmap

IOMMUs may declare memory regions spanning from 0 to UINT64_MAX. When
attempting to deal with such region, vfio_listener_region_del() passes a
size of 2^64 to int128_get64() which throws an assertion failure.  Even
ignoring this, the VFIO_IOMMU_DMA_MAP ioctl cannot handle this size
since the size field is 64-bit. Split the request in two.

Acked-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Message-Id: <20201030180510.747225-11-jean-philippe@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/vfio/common.c