aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/include/asm/elf.h3
-rw-r--r--arch/powerpc/kernel/process.c10
2 files changed, 12 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index 968b37f7a9f..1a856b15226 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -179,7 +179,8 @@ typedef elf_fpreg_t elf_vsrreghalf_t32[ELF_NVSRHALFREG];
179 the loader. We need to make sure that it is out of the way of the program 179 the loader. We need to make sure that it is out of the way of the program
180 that it will "exec", and that there is sufficient room for the brk. */ 180 that it will "exec", and that there is sufficient room for the brk. */
181 181
182#define ELF_ET_DYN_BASE (0x20000000) 182extern unsigned long randomize_et_dyn(unsigned long base);
183#define ELF_ET_DYN_BASE (randomize_et_dyn(0x20000000))
183 184
184/* 185/*
185 * Our registers are always unsigned longs, whether we're a 32 bit 186 * Our registers are always unsigned longs, whether we're a 32 bit
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 30b149ce759..eac06494878 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1170,3 +1170,13 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
1170 1170
1171 return ret; 1171 return ret;
1172} 1172}
1173
1174unsigned long randomize_et_dyn(unsigned long base)
1175{
1176 unsigned long ret = PAGE_ALIGN(base + brk_rnd());
1177
1178 if (ret < base)
1179 return base;
1180
1181 return ret;
1182}