summaryrefslogtreecommitdiffstats
path: root/patches/glibc-2.8/generic/gentoo/3000_all_2.3.6-dl_execstack-PaX-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/glibc-2.8/generic/gentoo/3000_all_2.3.6-dl_execstack-PaX-support.patch')
-rw-r--r--patches/glibc-2.8/generic/gentoo/3000_all_2.3.6-dl_execstack-PaX-support.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/patches/glibc-2.8/generic/gentoo/3000_all_2.3.6-dl_execstack-PaX-support.patch b/patches/glibc-2.8/generic/gentoo/3000_all_2.3.6-dl_execstack-PaX-support.patch
new file mode 100644
index 0000000..eca5d11
--- /dev/null
+++ b/patches/glibc-2.8/generic/gentoo/3000_all_2.3.6-dl_execstack-PaX-support.patch
@@ -0,0 +1,73 @@
+ 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).
+
+---
+ nptl/allocatestack.c | 3 ++-
+ sysdeps/unix/sysv/linux/dl-execstack.c | 19 ++++++++++++++++---
+ 2 files changed, 18 insertions(+), 4 deletions(-)
+
+Index: glibc-2.8-20080811/nptl/allocatestack.c
+===================================================================
+--- glibc-2.8-20080811.orig/nptl/allocatestack.c
++++ glibc-2.8-20080811/nptl/allocatestack.c
+@@ -299,7 +299,8 @@ change_stack_perm (struct pthread *pd
+ # 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;
+ }
+Index: glibc-2.8-20080811/sysdeps/unix/sysv/linux/dl-execstack.c
+===================================================================
+--- glibc-2.8-20080811.orig/sysdeps/unix/sysv/linux/dl-execstack.c
++++ glibc-2.8-20080811/sysdeps/unix/sysv/linux/dl-execstack.c
+@@ -63,7 +63,10 @@ _dl_make_stack_executable (void **stack_
+ else
+ # endif
+ {
+- result = errno;
++ if (errno == EACCES) /* PAX is enabled */
++ result = 0;
++ else
++ result = errno;
+ goto out;
+ }
+ }
+@@ -89,7 +92,12 @@ _dl_make_stack_executable (void **stack_
+ 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 @@ _dl_make_stack_executable (void **stack_
+ 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;