alistair23-linux/drivers/vfio
Alex Williamson 48d8476b41 vfio/type1: Fix task tracking for QEMU vCPU hotplug
MAP_DMA ioctls might be called from various threads within a process,
for example when using QEMU, the vCPU threads are often generating
these calls and we therefore take a reference to that vCPU task.
However, QEMU also supports vCPU hotplug on some machines and the task
that called MAP_DMA may have exited by the time UNMAP_DMA is called,
resulting in the mm_struct pointer being NULL and thus a failure to
match against the existing mapping.

To resolve this, we instead take a reference to the thread
group_leader, which has the same mm_struct and resource limits, but
is less likely exit, at least in the QEMU case.  A difficulty here is
guaranteeing that the capabilities of the group_leader match that of
the calling thread, which we resolve by tracking CAP_IPC_LOCK at the
time of calling rather than at an indeterminate time in the future.
Potentially this also results in better efficiency as this is now
recorded once per MAP_DMA ioctl.

Reported-by: Xu Yandong <xuyandong2@huawei.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2018-06-08 10:21:39 -06:00
..
mdev vfio: mdev: make a couple of functions and structure vfio_mdev_driver static 2018-01-09 12:13:08 -07:00
pci VFIO updates for v4.17-rc1 2018-04-06 19:44:27 -07:00
platform VFIO Updates for Linux v4.15 2017-11-14 16:47:47 -08:00
Kconfig vfio: Fix build break when SPAPR_TCE_IOMMU=n 2017-02-08 13:13:25 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vfio.c vfio: Simplify capability helper 2017-12-20 09:53:54 -07:00
vfio_iommu_spapr_tce.c vfio/spapr: Add cond_resched() for huge updates 2017-10-02 12:39:11 -06:00
vfio_iommu_type1.c vfio/type1: Fix task tracking for QEMU vCPU hotplug 2018-06-08 10:21:39 -06:00
vfio_spapr_eeh.c
virqfd.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00