diff options
author | Steve Sistare <[email protected]> | 2023-01-31 08:58:04 -0800 |
---|---|---|
committer | Alex Williamson <[email protected]> | 2023-02-09 11:39:14 -0700 |
commit | 046eca5018f8a5dd1dc2cedf87fb5843b9ea3026 (patch) | |
tree | bb4f28348e7ac703569d12aa7b247897a9fa8c2a /tools/perf/scripts/python/stackcollapse.py | |
parent | ef3a3f6a294ba65fd906a291553935881796f8a5 (diff) |
vfio/type1: prevent underflow of locked_vm via exec()
When a vfio container is preserved across exec, the task does not change,
but it gets a new mm with locked_vm=0, and loses the count from existing
dma mappings. If the user later unmaps a dma mapping, locked_vm underflows
to a large unsigned value, and a subsequent dma map request fails with
ENOMEM in __account_locked_vm.
To avoid underflow, grab and save the mm at the time a dma is mapped.
Use that mm when adjusting locked_vm, rather than re-acquiring the saved
task's mm, which may have changed. If the saved mm is dead, do nothing.
locked_vm is incremented for existing mappings in a subsequent patch.
Fixes: 73fa0d10d077 ("vfio: Type1 IOMMU implementation")
Cc: [email protected]
Signed-off-by: Steve Sistare <[email protected]>
Reviewed-by: Kevin Tian <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alex Williamson <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions