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

From: Al Boldi
Date: Thu Jul 13 2006 - 16:48:47 EST


Frank van Maarseveen wrote:
> 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.

exec.c uses arch_align_stack() also for non-elf.

BTW, why does randomize_stack_top() mod against (8192*1024) instead of (8192)
like arch_align_stack()?


Thanks!

--
Al

-
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/