linamh/sys-libs/glibc/files/2.3.4/glibc-2.3.4-dl_execstack-PaX-support.patch
2009-09-12 08:46:08 +00:00

51 lines
1.4 KiB
Diff

diff -Nru glibc-2.3.3.old/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2.3.3/sysdeps/unix/sysv/linux/dl-execstack.c
--- glibc-2.3.3.old/sysdeps/unix/sysv/linux/dl-execstack.c 2004-09-24 01:40:02.663710000 -0400
+++ glibc-2.3.3/sysdeps/unix/sysv/linux/dl-execstack.c 2004-09-24 01:54:55.883919888 -0400
@@ -56,11 +56,17 @@
__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
+ return errno;
+# if __ASSUME_PROT_GROWSUPDOWN == 0
+ }
# endif
- return errno;
}
#endif
@@ -84,8 +90,11 @@
page -= size;
else
{
- if (errno != ENOMEM) /* Unexpected failure mode. */
+ if (errno == EACCES) { /* PAX is enabled */
+ return 0;
+ } else if (errno != ENOMEM) { /* Unexpected failure mode. */
return errno;
+ }
if (size == GLRO(dl_pagesize))
/* We just tried to mprotect the top hole page and failed.
@@ -107,8 +116,11 @@
page += size;
else
{
- if (errno != ENOMEM) /* Unexpected failure mode. */
+ if (errno == EACCES) { /* PAX is enabled */
+ return 0;
+ } else if (errno != ENOMEM) { /* Unexpected failure mode. */
return errno;
+ }
if (size == GLRO(dl_pagesize))
/* We just tried to mprotect the lowest hole page and failed.