View Bug Activity | Format For Printing
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.
There will never be support for code in non-upstream kernels.