This series introduces generic functions to make top-down mmap layout easily accessible to architectures, in particular riscv which was the initial goal of this series. The generic implementation was taken from arm64 and used successively by arm, mips and finally riscv. Note that in addition the series fixes 2 issues: - stack randomization was taken into account even if not necessary. - [1] fixed an issue with mmap base which did not take into account randomization but did not report it to arm and mips, so by moving arm64 into a generic library, this problem is now fixed for both architectures. This work is an effort to factorize architecture functions to avoid code duplication and oversights as in [1]. [1]: https://www.mail-archive.com/linux-kernel@xxxxxxxxxxxxxxx/msg1429066.html Alexandre Ghiti (4): arm64, mm: Move generic mmap layout functions to mm arm: Use generic mmap top-down layout mips: Use generic mmap top-down layout riscv: Make mmap allocation top-down by default arch/arm/include/asm/processor.h | 2 +- arch/arm/mm/mmap.c | 52 ---------------- arch/arm64/include/asm/processor.h | 2 +- arch/arm64/mm/mmap.c | 72 ---------------------- arch/mips/include/asm/processor.h | 4 +- arch/mips/mm/mmap.c | 57 ----------------- arch/riscv/Kconfig | 12 ++++ arch/riscv/include/asm/processor.h | 1 + fs/binfmt_elf.c | 20 ------ include/linux/mm.h | 2 + kernel/sysctl.c | 6 +- mm/util.c | 99 +++++++++++++++++++++++++++++- 12 files changed, 121 insertions(+), 208 deletions(-) -- 2.20.1