Re: [PATCH] x86: Don't randomize stack unless current->personality permits it

From: Frank van Maarseveen
Date: Thu Jul 13 2006 - 05:42:17 EST


On Wed, Jul 12, 2006 at 06:03:18PM +0200, Andi Kleen wrote:
> Al Boldi <a1426z@xxxxxxxxx> writes:
>
> > Frank van Maarseveen wrote:
> > >
> > > Do not randomize stack location unless current->personality permits it.
[...]
> >
> > It still blips on my system.
> >
> > echo 0 > /proc/sys/kernel/randomize_va_space makes the blips go away.
> >
> > ???
>
> fs/binfmt_elf.c:randomize_stack_top would need the same check

Actually, randomize_stack_top() checks

if (current->flags & PF_RANDOMIZE) {

and it's only called from load_elf_binary() right after this:

if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
current->flags |= PF_RANDOMIZE;

Further on create_elf_tables() is called and that one calls arch_align_stack()
so maybe it is more appropriate to test (current->flags & PF_RANDOMIZE) in
arch_align_stack() instead of recomputing it.

--
Frank
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/