summaryrefslogtreecommitdiff
path: root/patches/glibc/ports-2.12.1/340-dl_execstack-PaX-support.patch
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-02-07 23:53:53 (GMT)
committerAlexey Neyman <stilor@att.net>2017-02-10 02:05:36 (GMT)
commitac4a37c8c43eca8443943c110521a39cec8bf5fc (patch)
treec92d906db51fdfd77ace5ccbcdc1a9cf11589172 /patches/glibc/ports-2.12.1/340-dl_execstack-PaX-support.patch
parentfb6fe0d70baaf4a3b545aa56b7b25a8457ab1204 (diff)
Revert "patches: remove obsolete glibc patches"
This partially reverts commit 429b3e884662a3b9a72890aae23865501e66330f. Bring back the patches for glibc 2.12 and newer. Propagate/refresh some patches as needed. Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'patches/glibc/ports-2.12.1/340-dl_execstack-PaX-support.patch')
-rw-r--r--patches/glibc/ports-2.12.1/340-dl_execstack-PaX-support.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/patches/glibc/ports-2.12.1/340-dl_execstack-PaX-support.patch b/patches/glibc/ports-2.12.1/340-dl_execstack-PaX-support.patch
new file mode 100644
index 0000000..afdb39c
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/340-dl_execstack-PaX-support.patch
@@ -0,0 +1,66 @@
+ With latest versions of glibc, a lot of apps failed on a PaX enabled
+ system with:
+ cannot enable executable stack as shared object requires: Permission denied
+
+ This is due to PaX 'exec-protecting' the stack, and ld.so then trying
+ to make the stack executable due to some libraries not containing the
+ PT_GNU_STACK section. Bug #32960. <azarah@gentoo.org> (12 Nov 2003).
+
+ Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
+
+diff -durN glibc-2.12.1.orig/nptl/allocatestack.c glibc-2.12.1/nptl/allocatestack.c
+--- glibc-2.12.1.orig/nptl/allocatestack.c 2009-01-29 21:34:16.000000000 +0100
++++ glibc-2.12.1/nptl/allocatestack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -329,7 +329,8 @@
+ # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+ #endif
+ if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
+- return errno;
++ if (errno != EACCES) /* PAX is enabled */
++ return errno;
+
+ return 0;
+ }
+diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2.12.1/sysdeps/unix/sysv/linux/dl-execstack.c
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/dl-execstack.c 2006-01-08 09:21:15.000000000 +0100
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/dl-execstack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -63,7 +63,10 @@
+ else
+ # endif
+ {
+- result = errno;
++ if (errno == EACCES) /* PAX is enabled */
++ result = 0;
++ else
++ result = errno;
+ goto out;
+ }
+ }
+@@ -89,7 +92,12 @@
+ page -= size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
+@@ -115,7 +123,12 @@
+ page += size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;