From e6ef07062a948b3640623b7d3f619e25ef0a4bf3 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Sun, 22 Feb 2009 01:50:07 +0000 Subject: [PATCH] --- yaml --- r: 138497 b: refs/heads/master c: 501cb16d3cfdcca99ac26fe122079f2a43b046b8 h: refs/heads/master i: 138495: dd4ac4b05883dbdf5573976ce9bbdaffaf978afd v: v3 --- [refs] | 2 +- trunk/arch/powerpc/include/asm/elf.h | 3 ++- trunk/arch/powerpc/kernel/process.c | 10 ++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 1b3feddf0307..48249b657309 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 002b0ec73dd8b784004e5a013ad9f2fa6274af5a +refs/heads/master: 501cb16d3cfdcca99ac26fe122079f2a43b046b8 diff --git a/trunk/arch/powerpc/include/asm/elf.h b/trunk/arch/powerpc/include/asm/elf.h index 968b37f7a9f8..1a856b15226e 100644 --- a/trunk/arch/powerpc/include/asm/elf.h +++ b/trunk/arch/powerpc/include/asm/elf.h @@ -179,7 +179,8 @@ typedef elf_fpreg_t elf_vsrreghalf_t32[ELF_NVSRHALFREG]; 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 diff --git a/trunk/arch/powerpc/kernel/process.c b/trunk/arch/powerpc/kernel/process.c index 30b149ce7598..eac064948780 100644 --- a/trunk/arch/powerpc/kernel/process.c +++ b/trunk/arch/powerpc/kernel/process.c @@ -1170,3 +1170,13 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) 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; +}