]> 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>
Fri, 11 Jun 2010 20:11:10 +0000 (15:11 -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 01b1ef63996cd8a0bf094342c9c717d46c54830c..0e4cdfb6cf9ad39561244ae8da47cc51c8ca29ce 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.
+
 2010-05-28  Luis Machado  <luisgpm@br.ibm.com>
 
        * sysdeps/powerpc/powerpc32/power7/memcpy.S: Exchange srdi for srwi.
index 597193c043463be8ebea5fca6fe7989ec8d25e03..ff02fe4fb02cb9a402864d518095243e9e842ba3 100644 (file)
@@ -996,8 +996,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 bcf0e2a5604e7caa03934fa25e1f4b6eae6efcf1..8d2d616ac5d11cc414694e6090c88ac733e6e4f5 100644 (file)
@@ -126,8 +126,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 55b84c3bf49f569c612af58f886b2e8df6293f06..bcaaf90f1af106ee1389ccb9b63c9a580a475a11 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