[PATCH 2/2] powerpc: Redefine ELF_ET_DYN_BASE

Bhupesh Sharma bhsharma at redhat.com
Thu Feb 2 16:42:48 AEDT 2017


Currently the powerpc arch uses a ELF_ET_DYN_BASE value of 0x20000000
which ends up pushing an elf to a load address which is 32-bit.

On 64-bit platforms, this might be too less especially when one is
trying to increase the randomness of the load address of the ASLR elfs
on such platforms.

This patch makes the powerpc platforms mimic the x86 ones, by ensuring
that the ELF_ET_DYN_BASE is calculated on basis of the current task's
TASK_SIZE.

Cc: Alexander Graf <agraf at suse.com>
Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Cc: Paul Mackerras <paulus at samba.org>
Cc: Michael Ellerman <mpe at ellerman.id.au>
Cc: Anatolij Gustschin <agust at denx.de>
Cc: Alistair Popple <alistair at popple.id.au>
Cc: Matt Porter <mporter at kernel.crashing.org>
Cc: Vitaly Bordug <vitb at kernel.crashing.org>
Cc: Scott Wood <oss at buserror.net>
Cc: Kumar Gala <galak at kernel.crashing.org>
Cc: Daniel Cashman <dcashman at android.com>
Cc: Kees Cook <keescook at chromium.org>
Signed-off-by: Bhupesh Sharma <bhsharma at redhat.com>
---
 arch/powerpc/include/asm/elf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index ee46ffef608e..dd035f6dd782 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -28,7 +28,7 @@
    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
+#define ELF_ET_DYN_BASE	(TASK_SIZE - PAGE_SIZE)
 
 #define ELF_CORE_EFLAGS (is_elf2_task() ? 2 : 0)
 
-- 
2.7.4



More information about the Linuxppc-dev mailing list