This is sources Bugzilla
Bugzilla Version 2.17.5
Bugzilla Bug 3332
  dl_execstack PaX support Last modified: 2006-10-11 08:18:01
     Query page      Enter new bug
Bug#: 3332   Hardware:   Reporter: Robert Connolly <robert@linuxfromscratch.org>
Host: Target: Build:
Product:     Add CC:
Component:   Version:   CC:
Remove selected CCs
Status: RESOLVED   Priority:  
Resolution: INVALID   Severity:  
Assigned To: Ulrich Drepper <drepper@redhat.com>   Target Milestone:  
Flags: Requestee:
  backport ()
  examined ()
  testsuite ()
Summary:
Keywords:

Attachment Description Type Created Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 3332 depends on: Show dependency tree
Show dependency graph
Bug 3332 blocks:

Additional Comments:


Leave as RESOLVED INVALID
Reopen bug
Mark bug as VERIFIED

View Bug Activity   |   Format For Printing


Description:   Last confirmed: 0000-00-00 00:00 Opened: 2006-10-11 07:59
The following patch is needed for PaX (pax.grsecurity.net) Linux kernel 
support. I don't think the changes will affect non-PaX systems:

diff -Naur glibc-2.3.6.orig/sysdeps/unix/sysv/linux/dl-execstack.c
glibc-2.3.6/sysdeps/unix/sysv/linux/dl-execstack.c
--- glibc-2.3.6.orig/sysdeps/unix/sysv/linux/dl-execstack.c	2005-07-18 
04:11:19.000000000 +0000
+++ glibc-2.3.6/sysdeps/unix/sysv/linux/dl-execstack.c	2005-11-13 
08:50:35.000000000 +0000
@@ -58,14 +58,20 @@
 					__stack_prot) == 0, 1))
 	goto return_success;
 # if __ASSUME_PROT_GROWSUPDOWN == 0
-      if (errno == EINVAL)
+      if (errno == EINVAL) {
 	no_growsupdown = true;
-      else
+      } else {
 # endif
+      if (errno == EACCES)		/* PAX is enabled */
+	return 0;
+      else
 	{
 	  result = errno;
 	  goto out;
 	}
+# if __ASSUME_PROT_GROWSUPDOWN == 0
+      }
+# endif
     }
 #endif
 
@@ -89,11 +95,14 @@
 	page -= size;
       else
 	{
-	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
+	  if (errno == EACCES) {	/* PAX is enabled  */
+	    return 0;
+	  } else if (errno != ENOMEM) { /* Unexpected failure mode.  */
 	    {
 	      result = errno;
 	      goto out;
 	    }
+	  }
 
 	  if (size == GLRO(dl_pagesize))
 	    /* We just tried to mprotect the top hole page and failed.
@@ -115,11 +124,14 @@
 	page += size;
       else
 	{
-	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
+	  if (errno == EACCES) {	/* PAX is enabled */
+	    return 0;
+	  } else if (errno != ENOMEM)  /* Unexpected failure mode.  */
 	    {
 	      result = errno;
 	      goto out;
 	    }
+	  }
 
 	  if (size == GLRO(dl_pagesize))
 	    /* We just tried to mprotect the lowest hole page and failed.

------- Additional Comment #1 From Ulrich Drepper 2006-10-11 08:18 -------
There will never be support for code in non-upstream kernels.

     Query page      Enter new bug
Actions: New | Query | bug # | Reports | Requests   New Account | Log In