patches/glibc/2_9/380-2.3.6-dl_execstack-PaX-support.patch
changeset 1273 33f0fcab7f03
parent 1272 ddac62e7c428
child 1274 96dfd5b53e38
     1.1 --- a/patches/glibc/2_9/380-2.3.6-dl_execstack-PaX-support.patch	Fri Mar 27 23:40:07 2009 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,71 +0,0 @@
     1.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/3000_all_2.3.6-dl_execstack-PaX-support.patch
     1.5 -
     1.6 --= BEGIN original header =-
     1.7 -	With latest versions of glibc, a lot of apps failed on a PaX enabled
     1.8 -	system with:
     1.9 -		 cannot enable executable stack as shared object requires: Permission denied
    1.10 -	
    1.11 -	This is due to PaX 'exec-protecting' the stack, and ld.so then trying
    1.12 -	to make the stack executable due to some libraries not containing the
    1.13 -	PT_GNU_STACK section.  Bug #32960.  <azarah@gentoo.org> (12 Nov 2003).
    1.14 -
    1.15 -	Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
    1.16 -
    1.17 --= END original header =-
    1.18 -
    1.19 -diff -durN glibc-2_9.orig/nptl/allocatestack.c glibc-2_9/nptl/allocatestack.c
    1.20 ---- glibc-2_9.orig/nptl/allocatestack.c	2008-08-16 00:35:27.000000000 +0200
    1.21 -+++ glibc-2_9/nptl/allocatestack.c	2009-02-02 22:01:20.000000000 +0100
    1.22 -@@ -299,7 +299,8 @@
    1.23 - # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
    1.24 - #endif
    1.25 -   if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
    1.26 --    return errno;
    1.27 -+    if (errno != EACCES) /* PAX is enabled */
    1.28 -+    	return errno;
    1.29 - 
    1.30 -   return 0;
    1.31 - }
    1.32 -diff -durN glibc-2_9.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2_9/sysdeps/unix/sysv/linux/dl-execstack.c
    1.33 ---- glibc-2_9.orig/sysdeps/unix/sysv/linux/dl-execstack.c	2006-01-08 09:21:15.000000000 +0100
    1.34 -+++ glibc-2_9/sysdeps/unix/sysv/linux/dl-execstack.c	2009-02-02 22:01:20.000000000 +0100
    1.35 -@@ -63,7 +63,10 @@
    1.36 -       else
    1.37 - # endif
    1.38 - 	{
    1.39 --	  result = errno;
    1.40 -+	  if (errno == EACCES)  /* PAX is enabled */
    1.41 -+	    result = 0;
    1.42 -+	  else
    1.43 -+	    result = errno;
    1.44 - 	  goto out;
    1.45 - 	}
    1.46 -     }
    1.47 -@@ -89,7 +92,12 @@
    1.48 - 	page -= size;
    1.49 -       else
    1.50 - 	{
    1.51 --	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
    1.52 -+	  if (errno == EACCES)		/* PAX is enabled */
    1.53 -+	    {
    1.54 -+	      result = 0;
    1.55 -+	      goto out;
    1.56 -+	    }
    1.57 -+	  else if (errno != ENOMEM)	/* Unexpected failure mode.  */
    1.58 - 	    {
    1.59 - 	      result = errno;
    1.60 - 	      goto out;
    1.61 -@@ -115,7 +123,12 @@
    1.62 - 	page += size;
    1.63 -       else
    1.64 - 	{
    1.65 --	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
    1.66 -+	  if (errno == EACCES)		/* PAX is enabled */
    1.67 -+	    {
    1.68 -+	      result = 0;
    1.69 -+	      goto out;
    1.70 -+	    }
    1.71 -+	  else if (errno != ENOMEM)	/* Unexpected failure mode.  */
    1.72 - 	    {
    1.73 - 	      result = errno;
    1.74 - 	      goto out;