This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/3332] New: dl_execstack PaX support
- From: "robert at linuxfromscratch dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 11 Oct 2006 07:59:40 -0000
- Subject: [Bug libc/3332] New: dl_execstack PaX support
- Reply-to: sourceware-bugzilla at sourceware dot org
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.
--
Summary: dl_execstack PaX support
Product: glibc
Version: unspecified
Status: NEW
Severity: enhancement
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: robert at linuxfromscratch dot org
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=3332
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.