Unperformant Restrictions for non-x86_32 archs
Andy Whitcroft
apw at canonical.com
Fri Mar 2 14:33:51 UTC 2012
On Wed, Feb 29, 2012 at 09:19:48AM +0000, Dieter Miosga wrote:
> Please change in file linux_32.0-17.27.diff
> at line 5268, and all following and preceding occurences , to
>
> --- linux-3.2.0.orig/arch/x86/kernel/process.c
> +++ linux-3.2.0/arch/x86/kernel/process.c
> @@ -663,6 +663,16 @@
> unsigned long arch_randomize_brk(struct mm_struct *mm)
> {
> unsigned long range_end = mm->brk + 0x02000000;
> - return randomize_range(mm->brk, range_end, 0) ? : mm->brk;
> +#ifdef CONFIG_X86_32
> + unsigned long bump = 0;
> + /* when using ASLR in arch_get_unmapped_exec_area, we must shove
> + the brk segment way out of the way of the exec area, since it
> + can collide with future allocations if not. */
> + if ( (mm->get_unmapped_exec_area == arch_get_unmapped_exec_area) &&
> + (mm->brk < 0x08000000) ) {
> + bump = (TASK_SIZE/6);
> + }
> + return bump + (randomize_range(mm->brk, range_end, 0) ? : mm->brk);
> +#else
> + return randomize_range(mm->brk, range_end, 0) ? : mm->brk;
> +#endif
>
> }
unsigned long arch_randomize_brk(struct mm_struct *mm)
{
unsigned long range_end = mm->brk + 0x02000000;
unsigned long bump = 0;
#ifdef CONFIG_X86_32
/* when using ASLR in arch_get_unmapped_exec_area, we must shove
the brk segment way out of the way of the exec area, since it
can collide with future allocations if not. */
if ( (mm->get_unmapped_exec_area == arch_get_unmapped_exec_area) &&
(mm->brk < 0x08000000) ) {
bump = (TASK_SIZE/6);
}
#endif
return bump + (randomize_range(mm->brk, range_end, 0) ? : mm->brk);
}
Currently the code looks as above. I think you are suggesting a change
to not add bump for the 64 bit case? Am I correct in that reading?
If so, then I cannot see how that would be a non-performant case, the
compiler can quite easily see that bump+ represents a constant 0+ and
trivially optimise it away?
-apw
More information about the ubuntu-devel
mailing list