]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: Change failure of MAP_FIXED to restoring the gap on failure
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 19 Aug 2024 19:16:33 +0000 (15:16 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 23 Aug 2024 12:46:02 +0000 (08:46 -0400)
commit026193ec5e58873dc0da73995884ad8ff5ecfaa0
tree100b5821bc7cb2b76e39fb86b7827b66b92889f1
parentefc924f657858d8fd5621f688eceabcb68caf6ea
mm: Change failure of MAP_FIXED to restoring the gap on failure

Prior to call_mmap(), the vmas that will be replaced need to clear the
way for what may happen in the call_mmap().  This clean up work includes
clearing the ptes and calling the close() vm_ops.  Some users do more
setup than can be restored by calling the vm_ops open() function.  It is
safer to store the gap in the vma tree in these cases.

That is to say that the failure scenario that existed before the
MAP_FIXED gap exposure is restored as it is safer than trying to undo a
partial mapping.

Since abort_munmap_vmas() is only reattaching vmas with this change, the
function is renamed to reattach_vmas().

There is also a secondary failure that may occur if there is not enough
memory to store the gap.  In this case, the vmas are reattached and
resources freed.  If the system cannot complete the call_mmap() and
fails to allocate with GFP_KERNEL, then the system will print a warning
about the failure.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
mm/mmap.c
mm/vma.c
mm/vma.h