This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix hppa/ia64/microblaze executable stack default (bug 22156)


As per https://gcc.gnu.org/ml/gcc-patches/2017-09/msg01220.html hppa,
ia64 and microblaze default to non-executable stacks in the Linux
kernel.  glibc however defines DEFAULT_STACK_PERMS to include PF_X for
those architectures, meaning (a) elf/check-execstack fails and (b)
(from code inspection, not tested, but this is why I think this is a
user-visible bug) thread stacks are unnecessarily mapped with execute
permission.  This patch fixes the DEFAULT_STACK_PERMS definitions in
question.

Tested (compilation only) with build-many-glibcs.py for those
configurations.  This fixes the check-execstack failure (hppa still
has a check-textrel failure as the only remaining issue stopping that
architecture having clean build-many-glibcs.py results; hopefully
architecture maintainers can help resolve that).

2017-09-19  Joseph Myers  <joseph@codesourcery.com>

	[BZ #22156]
	* sysdeps/hppa/stackinfo.h (DEFAULT_STACK_PERMS): Remove PF_X.
	* sysdeps/ia64/stackinfo.h (DEFAULT_STACK_PERMS): Likewise.
	* sysdeps/microblaze/stackinfo.h (DEFAULT_STACK_PERMS): Likewise.

diff --git a/sysdeps/hppa/stackinfo.h b/sysdeps/hppa/stackinfo.h
index 83b1da1..a3af38f 100644
--- a/sysdeps/hppa/stackinfo.h
+++ b/sysdeps/hppa/stackinfo.h
@@ -23,9 +23,8 @@
 
 #include <elf.h>
 
-/* Default to an executable stack.  PF_X can be overridden if PT_GNU_STACK is
- * present, but it is presumed absent.  */
-#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)
+/* Default to a non-executable stack.    */
+#define DEFAULT_STACK_PERMS (PF_R|PF_W)
 
 /* On PA the stack grows up.  */
 #define _STACK_GROWS_UP	1
diff --git a/sysdeps/ia64/stackinfo.h b/sysdeps/ia64/stackinfo.h
index 87e1448..a50e727 100644
--- a/sysdeps/ia64/stackinfo.h
+++ b/sysdeps/ia64/stackinfo.h
@@ -27,8 +27,7 @@
    here.  */
 #define _STACK_GROWS_DOWN	1
 
-/* Default to an executable stack.  PF_X can be overridden if PT_GNU_STACK is
- * present, but it is presumed absent.  */
-#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)
+/* Default to a non-executable stack.  */
+#define DEFAULT_STACK_PERMS (PF_R|PF_W)
 
 #endif	/* stackinfo.h */
diff --git a/sysdeps/microblaze/stackinfo.h b/sysdeps/microblaze/stackinfo.h
index 3062b1e..05755c7 100644
--- a/sysdeps/microblaze/stackinfo.h
+++ b/sysdeps/microblaze/stackinfo.h
@@ -27,8 +27,7 @@
 /* On MicroBlaze the stack grows down.  */
 # define _STACK_GROWS_DOWN	1
 
-/* Default to an executable stack.  PF_X can be overridden if PT_GNU_STACK is
- * present, but it is presumed absent.  */
-# define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)
+/* Default to a non-executable stack.  */
+# define DEFAULT_STACK_PERMS (PF_R|PF_W)
 
 #endif	/* stackinfo.h.  */

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]