Submitted By: Robert Connolly (ashes) Date: 2004-11-13 Initial Package Version: 2.3.6 Upstream Status: Submitted - http://sources.redhat.com/bugzilla/show_bug.cgi?id=3332 Origin: http://csociety-ftp.ecn.purdue.edu/pub/gentoo-portage/ \ sys-libs/glibc/files/2.3.3/glibc-2.3.3-dl_execstack-PaX-support.patch Description: This is needed for Pax. http://pax.grsecurity.net/ Also see: http://www.linuxfromscratch.org/hlfs/ 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.