summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/stackcollapse.py
diff options
context:
space:
mode:
authorAbdifatah Suruur <suruurism@gmail.com>2026-09-29 12:48:48 +0300
committerAlex Williamson <alex@shazbot.org>2026-09-29 14:25:55 -0600
commit8b25b35840c15ecca14251f68079792531f1758f (patch)
tree6a6e613f8349f1cde2e4f8d5a01dae0857f6e2d3 /tools/perf/scripts/python/stackcollapse.py
parent614634f262d83f367c993c1efd26230303f2e725 (diff)
downloadlinux-next-8b25b35840c15ecca14251f68079792531f1758f.tar.gz
linux-next-8b25b35840c15ecca14251f68079792531f1758f.zip
vfio/cdx: reject non-shared MMIO mmaps
vfio_cdx_mmap() accepts MAP_PRIVATE mappings. A non-shared mapping with VM_MAYWRITE is a COW mapping, and remap_pfn_range()'s COW special case in get_remap_pgoff() then overwrites vma->vm_pgoff with the physical frame number: if (is_cow) { if (addr != vm_start || end != vm_end) return -EINVAL; *vm_pgoff_p = pfn; } The VMA is inserted into the device file's mapping->i_mmap interval tree keyed by vm_pgoff, which VFIO expects to be the logical file offset: the core links every device mmap to the device inode's i_mapping precisely so that unmap_mapping_range() can revoke all mappings associated with a device (see vfio_device_open_file() and vfio_device_fops_cdev_open()). A raw PFN in vm_pgoff lands the interval tree entry in the wrong coordinate space, so unmap_mapping_range() cannot find the VMA and a stale MMIO mapping survives any revocation attempt. Without this check, a MAP_PRIVATE mapping reintroduces that corruption even with the logical-vm_pgoff fix in place. Require VM_SHARED as vfio-pci, vfio-fsl-mc and vfio-platform already do. This is defensive hygiene: vfio-cdx does not call unmap_mapping_range() today, so no reachable stale-mapping issue exists. Signed-off-by: Abdifatah Suruur <suruurism@gmail.com> Link: https://lore.kernel.org/r/20260929094848.7439-8-suruurism@gmail.com Signed-off-by: Alex Williamson <alex@shazbot.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions