From 501cb16d3cfdcca99ac26fe122079f2a43b046b8 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Sun, 22 Feb 2009 01:50:07 +0000 Subject: powerpc: Randomise PIEs Randomise ELF_ET_DYN_BASE, which is used when loading position independent executables. Signed-off-by: Anton Blanchard Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/kernel/process.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'arch/powerpc/kernel/process.c') 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) 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; +} -- cgit v1.2.3