Re: Patch 4/6 randomize the stack pointer

From: Christoph Hellwig
Date: Thu Jan 27 2005 - 15:46:12 EST


On Thu, Jan 27, 2005 at 03:40:48PM -0500, Rik van Riel wrote:
> On Thu, 27 Jan 2005, Christoph Hellwig wrote:
>
> >>+unsigned long arch_align_stack(unsigned long sp)
> >>+{
> >>+ if (randomize_va_space)
> >>+ sp -= ((get_random_int() % 4096) << 4);
> >>+ return sp & ~0xf;
> >>+}
> >
> >this looks like it'd work nicely on all architectures.
>
> I guess it should work for all architectures using ELF,
> not sure if it might break some of the more obscure
> architectures ...

So it works for all CONFIG_MMU architectures. Arjan mentioned that
the minimum stack alignment might be different, so the 4 should
become a per-arch constant and we can make the code unconditional
for CONFIG_MMU?
-
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/