mm-mmap-fix-map_fixed-address-return-on-vma-merge.patch removed from -mm tree
The quilt patch titled
Subject: mm/mmap: fix MAP_FIXED address return on VMA merge
has been removed from the -mm tree. Its filename was
mm-mmap-fix-map_fixed-address-return-on-vma-merge.patch
This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Liam Howlett <[email protected]>
Subject: mm/mmap: fix MAP_FIXED address return on VMA merge
Date: Tue, 18 Oct 2022 19:17:12 +0000
mmap should return the start address of newly mapped area when successful. On a successful merge of a VMA, the return address was changed and thus was violating that expectation from userspace.
This is a restoration of functionality provided by 309d08d9b3a3 (mm/mmap.c: fix mmap return value when vma is merged after call_mmap()). For completeness of fixing MAP_FIXED, implement the comments from the previous discussion to never update the address and fail if the address changes. Leaving the error as a WARN_ON() to avoid crashing the kernel.
---
mm/mmap.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
mm/mmap.c renamed from mm/mmap.c~mm-mmap-fix-map_fixed-address-return-on-vma-merge +7 -8
@@ -2626,14 +2626,14 @@ cannot_expand:if (error) goto unmap_and_free_vma; -/* Can addr have changed?? -* -* Answer: Yes, several device drivers can do it in their -* f_op->mmap method. -DaveM +/* +* Expansion is handled above, merging is handled below. +* Drivers should not alter the address of the VMA. */ -WARN_ON_ONCE (addr != vma->vm_start); - - addr = vma->vm_start; +if (WARN_ON ((addr != vma->vm_start))) { + error = -EINVAL ; + goto close_and_free_vma; + }mas_reset (&mas);/*
@@ -2655,7 +2655,6 @@ cannot_expand:vm_area_free (vma); vma = merge;/* Update vm_flags to pick up the change. */ - addr = vma->vm_start; vm_flags = vma->vm_flags; goto unmap_writable; }
_
Patches currently in -mm which might be from [email protected] are