parisc: Use generic mmap top-down layout and brk randomization
Subsystems (3)
PATCH 1/1 parisc: Use generic mmap top-down layout and brk randomization
From: Helge Deller <[email protected]>
parisc uses a top-down layout by default that exactly fits the generic functions, so get rid of arch specific code and use the generic version by selecting ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT.
Note that on parisc the stack always grows up and a "unlimited stack" simply means that the value as defined in CONFIG_STACK_MAX_DEFAULT_SIZE_MB should be used. So RLIM_INFINITY is not an indicator to use the legacy memory layout.
Signed-off-by Helge Deller <[email protected]>
--- arch/parisc/Kconfig | 17 +++++++++++ arch/parisc/kernel/process.c | 14 --------- arch/parisc/kernel/sys_parisc.c | 54 +-------------------------------- mm/util.c | 5 ++- 4 files changed, 22 insertions(+), 68 deletions(-)
arch/parisc/Kconfig +17 -0
@@ -49,6 +49,9 @@ config PARISC select TTY # Needed for pdc_cons.c select HAS_IOPORT if PCI || EISA select HAVE_DEBUG_STACKOVERFLOW + select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT + select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT + select HAVE_ARCH_MMAP_RND_BITS select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_HASH select HAVE_ARCH_JUMP_LABEL
@@ -124,6 +127,20 @@ config TIME_LOW_RES depends on SMP default y +config ARCH_MMAP_RND_BITS_MIN + default 18 if 64BIT + default 8 + +config ARCH_MMAP_RND_COMPAT_BITS_MIN + default 8 + +config ARCH_MMAP_RND_BITS_MAX + default 24 if 64BIT + default 17 + +config ARCH_MMAP_RND_COMPAT_BITS_MAX + default 17 + # unless you want to implement ACPI on PA-RISC ... ;-) config PM bool
arch/parisc/kernel/process.c +0 -14
@@ -278,17 +278,3 @@ __get_wchan(struct task_struct *p) }while (count++ <MAX_UNWIND_ENTRIES );return 0 ; } - -static inline unsigned long brk_rnd (void ) -{ -return (get_random_u32 () &BRK_RND_MASK ) <<PAGE_SHIFT ; -} - -unsigned long arch_randomize_brk (struct mm_struct *mm) -{ -unsigned long ret =PAGE_ALIGN (mm->brk +brk_rnd ()); - -if (ret < mm->brk) -return mm->brk; -return ret; -}
arch/parisc/kernel/sys_parisc.c +1 -53
66 lines not on this page · raw message
mm/util.c +4 -1
@@ -396,7 +396,10 @@ static int mmap_is_legacy(struct rlimit *rlim_stack)if (current->personality &ADDR_COMPAT_LAYOUT )return 1 ; -if (rlim_stack->rlim_cur ==RLIM_INFINITY ) +/* On parisc the stack always grows up - so a unlimited stack should +* not be an indicator to use the legacy memory layout. */ +if (rlim_stack->rlim_cur ==RLIM_INFINITY && + !IS_ENABLED (CONFIG_STACK_GROWSUP ))return 1 ;return sysctl_legacy_va_layout;
Signature · 1 line
2.41.0