[PATCH] UBUNTU: SAUCE: x86: brk away from exec rand area
Jeremy Kerr
jeremy.kerr at canonical.com
Sat Jan 16 00:04:05 UTC 2010
Hi Kees,
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index b10acea..73594b9 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -978,6 +978,16 @@ static int load_elf_binary(struct linux_binprm *bprm,
> struct pt_regs *regs) #ifdef arch_randomize_brk
> if ((current->flags & PF_RANDOMIZE) && (randomize_va_space > 1))
> current->mm->brk = current->mm->start_brk =
> +# ifdef CONFIG_X86_32
> + /* in the case of NX emulation, shove the brk
> + segment way out of the way of the exec
> + randomization area, since it can collide with
> + future allocations if not. */
> + ( (current->mm->get_unmapped_exec_area ==
> + arch_get_unmapped_exec_area) &&
> + (current->mm->brk < 0x08000000)
> + ? (TASK_SIZE/6) : 0) +
> +# endif
> arch_randomize_brk(current->mm);
Seeing as this is arch specific, it might be best to put it in
arch_randomize_brk, if possible.
Cheers,
Jeremy
More information about the kernel-team
mailing list