summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSteve Sistare <steven.sistare@oracle.com>2023-01-31 08:58:04 -0800
committerAlex Williamson <alex.williamson@redhat.com>2023-02-09 11:39:14 -0700
commit046eca5018f8a5dd1dc2cedf87fb5843b9ea3026 (patch)
treebb4f28348e7ac703569d12aa7b247897a9fa8c2a /scripts
parentef3a3f6a294ba65fd906a291553935881796f8a5 (diff)
downloadlinux-stable-046eca5018f8a5dd1dc2cedf87fb5843b9ea3026.tar.gz
linux-stable-046eca5018f8a5dd1dc2cedf87fb5843b9ea3026.tar.bz2
linux-stable-046eca5018f8a5dd1dc2cedf87fb5843b9ea3026.zip
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: 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-3-git-send-email-steven.sistare@oracle.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions