Skip to content

Commit 79d1f5c

Browse files
wildea01Russell King
authored andcommitted
ARM: 7641/1: memory: fix broken mmap by ensuring TASK_UNMAPPED_BASE is aligned
We have received multiple reports of mmap failures when running with a 2:2 vm split. These manifest as either -EINVAL with a non page-aligned address (ending 0xaaa) or a SEGV, depending on the application. The issue is commonly observed in children of make, which appears to use bottom-up mmap (assumedly because it changes the stack rlimit). Further investigation reveals that this regression was triggered by 394ef64 ("mm: use vm_unmapped_area() on arm architecture"), whereby TASK_UNMAPPED_BASE is no longer page-aligned for bottom-up mmap, causing get_unmapped_area to choke on misaligned addressed. This patch fixes the problem by defining TASK_UNMAPPED_BASE in terms of TASK_SIZE and explicitly aligns the result to 16M, matching the other end of the heap. Acked-by: Nicolas Pitre <nico@linaro.org> Reported-by: Steve Capper <steve.capper@arm.com> Reported-by: Jean-Francois Moine <moinejf@free.fr> Reported-by: Christoffer Dall <cdall@cs.columbia.edu> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 633dc92 commit 79d1f5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm/include/asm/memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838
#define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET)
3939
#define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(0x01000000))
40-
#define TASK_UNMAPPED_BASE (UL(CONFIG_PAGE_OFFSET) / 3)
40+
#define TASK_UNMAPPED_BASE ALIGN(TASK_SIZE / 3, SZ_16M)
4141

4242
/*
4343
* The maximum size of a 26-bit user space task.

0 commit comments

Comments
 (0)