]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Experimental patch to default PPC64 to no-execstack support. This will need
authorRyan Arnold <ryanarn@etna.rchland.ibm.com>
Fri, 11 Jun 2010 20:11:10 +0000 (15:11 -0500)
committerRyan Arnold <ryanarn@etna.rchland.ibm.com>
Tue, 29 Jun 2010 22:09:36 +0000 (17:09 -0500)
to be abstracted to remove the guards from common files and put the stack
initialization into a header file that can be overridden.

2010-06-11  Ryan S. Arnold  <rsa@us.ibm.com>

* elf/dl-load.c (_dl_map_object_from_fd): Set default stack_flags to
no-exec for ARCH_PPC64.
* elf/dl-support.c [_dl_stack_flags]: Set default stack_flags to
no-exec for ARCH_PPC64.
* elf/rtld.c (_dl_starting_up): Set default stack_flags to no-exec for
ARCH_PPC64.

ChangeLog
elf/dl-load.c
elf/dl-support.c
elf/rtld.c

index 928c74aff46874d6fd3becffeb825e47aef4ee26..1108ebc3c510c07676acbced9319c6950839516e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-06-11  Ryan S. Arnold  <rsa@us.ibm.com>
+
+       * elf/dl-load.c (_dl_map_object_from_fd): Set default stack_flags to
+       no-exec for ARCH_PPC64.
+       * elf/dl-support.c [_dl_stack_flags]: Set default stack_flags to
+       no-exec for ARCH_PPC64.
+       * elf/rtld.c (_dl_starting_up): Set default stack_flags to no-exec for
+       ARCH_PPC64.
+
 2009-09-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        * configure.in: Support binutils 2.20.
index 94531b271f871ec94b3a6526a30ad24b7b151b87..ca7115ee1b3583f725070e01032ee0a606cce21a 100644 (file)
@@ -1000,8 +1000,13 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
        }
     }
 
+#if (defined (_ARCH_PPC64) || defined (__powerpc64__))
+  /* Default to no-exec stack on PPC64.  */
+  uint_fast16_t stack_flags = PF_R|PF_W;
+#else
   /* Presumed absent PT_GNU_STACK.  */
   uint_fast16_t stack_flags = PF_R|PF_W|PF_X;
+#endif
 
   {
     /* Scan the program header table, collecting its load commands.  */
index 2c11ac68816e00f290ed70d05630c0dae620103f..582d3ed98d4c6f12067c4773f19051d9e25a7d7d 100644 (file)
@@ -122,8 +122,15 @@ ElfW(Phdr) *_dl_phdr;
 size_t _dl_phnum;
 uint64_t _dl_hwcap __attribute__ ((nocommon));
 
+
+#if (defined (_ARCH_PPC64) || defined (__powerpc64__))
+/* Default to no-exec stack on PPC64.  */
+/* Prevailing state of the stack, PF_X indicating it's executable.  */
+ElfW(Word) _dl_stack_flags = PF_R|PF_W;
+#else
 /* Prevailing state of the stack, PF_X indicating it's executable.  */
 ElfW(Word) _dl_stack_flags = PF_R|PF_W|PF_X;
+#endif
 
 /* If loading a shared object requires that we make the stack executable
    when it was not, we do it by calling this function.
index 46bece7fa328bde6ef1b2fac8a016e3e13bb2fc0..95ba8858e153741bd57c9a3abc221421c521b48c 100644 (file)
@@ -123,7 +123,12 @@ INTVARDEF(_dl_starting_up)
 struct rtld_global _rtld_global =
   {
     /* Default presumption without further information is executable stack.  */
+#if (defined (_ARCH_PPC64) || defined (__powerpc64__))
+    /* Default to no-exec stack on PPC64.  */
+    ._dl_stack_flags = PF_R|PF_W,
+#else
     ._dl_stack_flags = PF_R|PF_W|PF_X,
+#endif
 #ifdef _LIBC_REENTRANT
     ._dl_load_lock = _RTLD_LOCK_RECURSIVE_INITIALIZER
 #endif