brk randomization: introduce CONFIG_COMPAT_BRK
based on similar patch from: Pavel Machek <pavel@ucw.cz> Introduce CONFIG_COMPAT_BRK. If disabled then the kernel is free (but not obliged to) randomize the brk area. Heap randomization breaks ancient binaries, so we keep COMPAT_BRK enabled by default. Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
@@ -1077,7 +1077,7 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
|
||||
current->mm->start_stack = bprm->p;
|
||||
|
||||
#ifdef arch_randomize_brk
|
||||
if (current->flags & PF_RANDOMIZE)
|
||||
if ((current->flags & PF_RANDOMIZE) && (randomize_va_space > 1))
|
||||
current->mm->brk = current->mm->start_brk =
|
||||
arch_randomize_brk(current->mm);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user