Re: [PATCH REBASE v4 05/14] arm64, mm: Make randomization selected by generic topdown mmap layout
From: Luis Chamberlain
Date: Wed Jul 24 2019 - 13:11:30 EST
On Wed, Jul 24, 2019 at 01:58:41AM -0400, Alexandre Ghiti wrote:
> diff --git a/mm/util.c b/mm/util.c
> index 0781e5575cb3..16f1e56e2996 100644
> --- a/mm/util.c
> +++ b/mm/util.c
> @@ -321,7 +321,15 @@ unsigned long randomize_stack_top(unsigned long stack_top)
> }
>
> #ifdef CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
> -#ifdef CONFIG_ARCH_HAS_ELF_RANDOMIZE
> +unsigned long arch_randomize_brk(struct mm_struct *mm)
> +{
> + /* Is the current task 32bit ? */
> + if (!IS_ENABLED(CONFIG_64BIT) || is_compat_task())
> + return randomize_page(mm->brk, SZ_32M);
> +
> + return randomize_page(mm->brk, SZ_1G);
> +}
> +
> unsigned long arch_mmap_rnd(void)
> {
> unsigned long rnd;
> @@ -335,7 +343,6 @@ unsigned long arch_mmap_rnd(void)
>
> return rnd << PAGE_SHIFT;
> }
So arch_randomize_brk is no longer ifdef'd around
CONFIG_ARCH_HAS_ELF_RANDOMIZE either and yet the header
still has it. Is that intentional?
Luis