Commit 92980405f3537136b8e81007a9df576762f49bbb
Committed by
Catalin Marinas
1 parent
e2b6b35ee7
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
arm64: ASLR: Don't randomise text when randomise_va_space == 0
When user asks to turn off ASLR by writing "0" to /proc/sys/kernel/randomize_va_space there should not be any randomization to mmap base, stack, VDSO, libs, text and heap Currently arm64 violates this behavior by randomising text. Fix this by defining a constant ELF_ET_DYN_BASE. The randomisation of mm->mmap_base is done by setup_new_exec -> arch_pick_mmap_layout -> mmap_base -> mmap_rnd. Signed-off-by: Arun Chandran <achandran@mvista.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Showing 3 changed files with 3 additions and 7 deletions Side-by-side Diff
arch/arm64/Kconfig
arch/arm64/include/asm/elf.h
... | ... | @@ -126,7 +126,7 @@ |
126 | 126 | * that it will "exec", and that there is sufficient room for the brk. |
127 | 127 | */ |
128 | 128 | extern unsigned long randomize_et_dyn(unsigned long base); |
129 | -#define ELF_ET_DYN_BASE (randomize_et_dyn(2 * TASK_SIZE_64 / 3)) | |
129 | +#define ELF_ET_DYN_BASE (2 * TASK_SIZE_64 / 3) | |
130 | 130 | |
131 | 131 | /* |
132 | 132 | * When the program starts, a1 contains a pointer to a function to be |
... | ... | @@ -169,7 +169,7 @@ |
169 | 169 | #define COMPAT_ELF_PLATFORM ("v8l") |
170 | 170 | #endif |
171 | 171 | |
172 | -#define COMPAT_ELF_ET_DYN_BASE (randomize_et_dyn(2 * TASK_SIZE_32 / 3)) | |
172 | +#define COMPAT_ELF_ET_DYN_BASE (2 * TASK_SIZE_32 / 3) | |
173 | 173 | |
174 | 174 | /* AArch32 registers. */ |
175 | 175 | #define COMPAT_ELF_NGREG 18 |