vfio/type1: exclude mdevs from VFIO_UPDATE_VADDR
authorSteve Sistare <steven.sistare@oracle.com>
Tue, 31 Jan 2023 16:58:03 +0000 (08:58 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:34:32 +0000 (09:34 +0100)
commite8c21b19c2d0c4f5ad0e5b504c18e4e25e737e5f
tree59f129d11c1d2680c8ffa5bb00059dd132d8035f
parent2bed9455db7cc0ab7ece6b3d846472097b52855a
vfio/type1: exclude mdevs from VFIO_UPDATE_VADDR

commit ef3a3f6a294ba65fd906a291553935881796f8a5 upstream.

Disable the VFIO_UPDATE_VADDR capability if mediated devices are present.
Their kernel threads could be blocked indefinitely by a misbehaving
userland while trying to pin/unpin pages while vaddrs are being updated.

Do not allow groups to be added to the container while vaddr's are invalid,
so we never need to block user threads from pinning, and can delete the
vaddr-waiting code in a subsequent patch.

Fixes: c3cbab24db38 ("vfio/type1: implement interfaces to update vaddr")
Cc: stable@vger.kernel.org
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/1675184289-267876-2-git-send-email-steven.sistare@oracle.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/vfio/vfio_iommu_type1.c
include/uapi/linux/vfio.h