linamh/sys-libs/glibc/files/2.3.3/glibc-2.3.3-dl_execstack-PaX-support.patch

71 lines
1.7 KiB
Diff
Raw Normal View History

--- glibc-2.3.3/sysdeps/unix/sysv/linux/dl-execstack.c 2003-12-13 15:42:16.853396224 +0200
+++ glibc-2.3.3.PaX/sysdeps/unix/sysv/linux/dl-execstack.c 2003-12-13 15:42:25.290113648 +0200
@@ -47,11 +47,17 @@
PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN) == 0)
goto return_success;
# if __ASSUME_PROT_GROWSUPDOWN == 0
- if (errno == EINVAL)
+ if (errno == EINVAL) {
no_growsdown = true;
- else
+ } else {
+# endif
+ if (errno == EACCES) /* PAX is enabled */
+ return 0;
+ else
+ return errno;
+# if __ASSUME_PROT_GROWSUPDOWN == 0
+ }
# endif
- return errno;
}
# endif
@@ -73,8 +79,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 == GL(dl_pagesize))
/* We just tried to mprotect the top hole page and failed.
@@ -105,11 +114,17 @@
PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSUP) == 0)
goto return_success;
# if __ASSUME_PROT_GROWSUPDOWN == 0
- if (errno == EINVAL)
+ if (errno == EINVAL) {
no_growsup = true;
- else
+ } else {
+# endif
+ if (errno == EACCES) /* PAX is enabled */
+ return 0;
+ else
+ return errno;
+# if __ASSUME_PROT_GROWSUPDOWN == 0
+ }
# endif
- return errno;
}
# endif
@@ -130,8 +145,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 == GL(dl_pagesize))
/* We just tried to mprotect the lowest hole page and failed.