@@ -95,7 +95,7 @@
#define arch_get_mmap_end(addr, len, flags) \
(((addr) > DEFAULT_MAP_WINDOW) ? TASK_SIZE : DEFAULT_MAP_WINDOW)
-#define arch_get_mmap_base(addr, base) ((addr > DEFAULT_MAP_WINDOW) ? \
+#define arch_get_mmap_base(addr, len, base, flags) ((addr > DEFAULT_MAP_WINDOW) ? \
base + TASK_SIZE - DEFAULT_MAP_WINDOW :\
base)
#endif /* CONFIG_ARM64_FORCE_52BIT */
@@ -72,7 +72,7 @@
#define STACK_TOP_MAX TASK_SIZE_USER64
#define STACK_TOP (is_32bit_task() ? STACK_TOP_USER32 : STACK_TOP_USER64)
-#define arch_get_mmap_base(addr, base) \
+#define arch_get_mmap_base(addr, len, base, flags) \
(((addr) > DEFAULT_MAP_WINDOW) ? (base) + TASK_SIZE - DEFAULT_MAP_WINDOW : (base))
#define arch_get_mmap_end(addr, len, flags) \
@@ -19,7 +19,7 @@
STACK_TOP_MAX; \
})
-#define arch_get_mmap_base(addr, base, flags) \
+#define arch_get_mmap_base(addr, len, base, flags) \
({ \
base; \
})
@@ -195,7 +195,7 @@ hugetlb_get_unmapped_area_topdown(struct file *file, unsigned long addr,
info.flags = VM_UNMAPPED_AREA_TOPDOWN;
info.length = len;
info.low_limit = PAGE_SIZE;
- info.high_limit = arch_get_mmap_base(addr, current->mm->mmap_base);
+ info.high_limit = arch_get_mmap_base(addr, len, current->mm->mmap_base, flags);
info.align_mask = PAGE_MASK & ~huge_page_mask(h);
addr = vm_unmapped_area(&info);
@@ -174,7 +174,7 @@ static inline void mm_update_next_owner(struct mm_struct *mm)
#endif
#ifndef arch_get_mmap_base
-#define arch_get_mmap_base(addr, base) (base)
+#define arch_get_mmap_base(addr, len, base, flags) (base)
#endif
extern void arch_pick_mmap_layout(struct mm_struct *mm,
@@ -1861,7 +1861,7 @@ generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
info.flags = VM_UNMAPPED_AREA_TOPDOWN;
info.length = len;
info.low_limit = PAGE_SIZE;
- info.high_limit = arch_get_mmap_base(addr, mm->mmap_base);
+ info.high_limit = arch_get_mmap_base(addr, len, mm->mmap_base, flags);
addr = vm_unmapped_area(&info);
/*
The flag and len param is required in arch_get_mmap_base() to implement MAP_BELOW_HINT. Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> --- arch/arm64/include/asm/processor.h | 2 +- arch/powerpc/include/asm/task_size_64.h | 2 +- arch/riscv/include/asm/processor.h | 2 +- fs/hugetlbfs/inode.c | 2 +- include/linux/sched/mm.h | 2 +- mm/mmap.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)