Randomise ELF_ET_DYN_BASE, which is used when loading position independent executables.
Signed-off-by: Anton Blanchard <an...@samba.org> --- Index: linux-2.6/arch/powerpc/include/asm/elf.h =================================================================== --- linux-2.6.orig/arch/powerpc/include/asm/elf.h 2009-02-22 21:18:04.000000000 +1100 +++ linux-2.6/arch/powerpc/include/asm/elf.h 2009-02-22 21:34:49.000000000 +1100 @@ -178,7 +178,8 @@ the loader. We need to make sure that it is out of the way of the program that it will "exec", and that there is sufficient room for the brk. */ -#define ELF_ET_DYN_BASE (0x20000000) +extern unsigned long randomize_et_dyn(unsigned long base); +#define ELF_ET_DYN_BASE (randomize_et_dyn(0x20000000)) /* * Our registers are always unsigned longs, whether we're a 32 bit Index: linux-2.6/arch/powerpc/kernel/process.c =================================================================== --- linux-2.6.orig/arch/powerpc/kernel/process.c 2009-02-22 21:21:14.000000000 +1100 +++ linux-2.6/arch/powerpc/kernel/process.c 2009-02-22 21:36:02.000000000 +1100 @@ -1154,3 +1154,13 @@ return ret; } + +unsigned long randomize_et_dyn(unsigned long base) +{ + unsigned long ret = PAGE_ALIGN(base + brk_rnd()); + + if (ret < base) + return base; + + return ret; +} -- _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev