diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2020-08-17 11:08:18 -0600 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2020-08-17 11:08:18 -0600 |
commit | bc93b9ae0151ae5ad5b8504cdc598428ea99570b (patch) | |
tree | b012d09a94182067f7d06aed9b4639fe8116f1f9 /drivers/vfio/Kconfig | |
parent | 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5 (diff) | |
download | lwn-bc93b9ae0151ae5ad5b8504cdc598428ea99570b.tar.gz lwn-bc93b9ae0151ae5ad5b8504cdc598428ea99570b.zip |
vfio-pci: Avoid recursive read-lock usage
A down_read on memory_lock is held when performing read/write accesses
to MMIO BAR space, including across the copy_to/from_user() callouts
which may fault. If the user buffer for these copies resides in an
mmap of device MMIO space, the mmap fault handler will acquire a
recursive read-lock on memory_lock. Avoid this by reducing the lock
granularity. Sequential accesses requiring multiple ioread/iowrite
cycles are expected to be rare, therefore typical accesses should not
see additional overhead.
VGA MMIO accesses are expected to be non-fatal regardless of the PCI
memory enable bit to allow legacy probing, this behavior remains with
a comment added. ioeventfds are now included in memory access testing,
with writes dropped while memory space is disabled.
Fixes: abafbc551fdd ("vfio-pci: Invalidate mmaps and block MMIO access on disabled memory")
Reported-by: Zhiyi Guo <zhguo@redhat.com>
Tested-by: Zhiyi Guo <zhguo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/Kconfig')
0 files changed, 0 insertions, 0 deletions