Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1672929

[PATCH 3/4] powerpc: Reduce ELF_ET_DYN_BASE

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject [PATCH 3/4] powerpc: Reduce ELF_ET_DYN_BASE
Date 2017-06-22 20:10 +0200
Message-ID <tVeIi-8fG-9@gated-at.bofh.it> (permalink)
References <tVeIi-8fG-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Now that explicitly executed loaders are loaded in the mmap region,
position PIE binaries lower in the address space to avoid possible
collisions with mmap or stack regions. For 64-bit, align to 4GB to
allow runtimes to use the entire 32-bit address space for 32-bit
pointers.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/powerpc/include/asm/elf.h | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index 09bde6e34f5d..548d9a411a0d 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -23,12 +23,13 @@
 #define CORE_DUMP_USE_REGSET
 #define ELF_EXEC_PAGESIZE	PAGE_SIZE
 
-/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
-   use of this is to invoke "./ld.so someprog" to test out a new version of
-   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
+/*
+ * This is the base location for PIE (ET_DYN with INTERP) loads. On
+ * 64-bit, this is raised to 4GB to leave the entire 32-bit address
+ * space open for things that want to use the area for 32-bit pointers.
+ */
+#define ELF_ET_DYN_BASE		(is_32bit_task() ? 0x000400000UL : \
+						   0x100000000UL)
 
 #define ELF_CORE_EFLAGS (is_elf2_task() ? 2 : 0)
 
-- 
2.7.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 3/4] powerpc: Reduce ELF_ET_DYN_BASE Kees Cook <keescook@chromium.org> - 2017-06-22 20:10 +0200
  Re: [PATCH 3/4] powerpc: Reduce ELF_ET_DYN_BASE Michael Ellerman <mpe@ellerman.id.au> - 2017-06-23 09:10 +0200
    Re: [PATCH 3/4] powerpc: Reduce ELF_ET_DYN_BASE Kees Cook <keescook@chromium.org> - 2017-06-23 22:10 +0200
      Re: [PATCH 3/4] powerpc: Reduce ELF_ET_DYN_BASE Michael Ellerman <mpe@ellerman.id.au> - 2017-06-26 15:10 +0200
        Re: [PATCH 3/4] powerpc: Reduce ELF_ET_DYN_BASE Kees Cook <keescook@chromium.org> - 2017-06-26 20:30 +0200

csiph-web