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

From: Andi Kleen
Date: Wed Jul 12 2006 - 12:01:30 EST


Al Boldi <a1426z@xxxxxxxxx> writes:

> Frank van Maarseveen wrote:
> >
> > Do not randomize stack location unless current->personality permits it.
> >
> > Signed-off-by: Frank van Maarseveen <frankvm@xxxxxxxxxxx>
> > ---
> >
> > The problem seems also present in
> >
> > arch/um/kernel/process_kern.c
> > arch/x86_64/kernel/process.c
> >
> > arch/i386/kernel/process.c | 3 ++-
> > 1 files changed, 2 insertions(+), 1 deletion(-)
> >
> > diff -rup a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
> > --- a/arch/i386/kernel/process.c 2006-06-23 16:08:13.000000000
> > +0200 +++ b/arch/i386/kernel/process.c 2006-07-11
> > 14:39:20.000000000 +0200 @@ -38,6 +38,7 @@
> > #include <linux/kallsyms.h>
> > #include <linux/ptrace.h>
> > #include <linux/random.h>
> > +#include <linux/personality.h>
> >
> > #include <asm/uaccess.h>
> > #include <asm/pgtable.h>
> > @@ -898,7 +899,7 @@ asmlinkage int sys_get_thread_area(struc
> >
> > unsigned long arch_align_stack(unsigned long sp)
> > {
> > - if (randomize_va_space)
> > + if (!(current->personality & ADDR_NO_RANDOMIZE) &&
> > randomize_va_space) sp -= get_random_int() % 8192;
> > return sp & ~0xf;
> > }
>
> 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
-Andi
-
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/