60 lines
1.9 KiB
Diff
60 lines
1.9 KiB
Diff
|
Index: sysdeps/unix/sysv/linux/dl-execstack.c
|
||
|
===================================================================
|
||
|
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/dl-execstack.c,v
|
||
|
retrieving revision 1.3
|
||
|
diff -u -p -r1.3 dl-execstack.c
|
||
|
--- sysdeps/unix/sysv/linux/dl-execstack.c 25 Sep 2003 23:04:12 -0000 1.3
|
||
|
+++ sysdeps/unix/sysv/linux/dl-execstack.c 8 Nov 2003 00:34:33 -0000
|
||
|
@@ -41,8 +41,11 @@ _dl_make_stack_executable (void)
|
||
|
if (__mprotect ((void *) page, GL(dl_pagesize),
|
||
|
PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN) == 0)
|
||
|
return 0;
|
||
|
- if (errno != EINVAL)
|
||
|
+ if (errno == EACCES) { /* PAX is enabled */
|
||
|
+ return 0;
|
||
|
+ } else if (errno != EINVAL) {
|
||
|
return errno;
|
||
|
+ }
|
||
|
no_growsdown = true;
|
||
|
}
|
||
|
# endif
|
||
|
@@ -64,8 +67,11 @@ _dl_make_stack_executable (void)
|
||
|
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.
|
||
|
@@ -92,8 +98,11 @@ _dl_make_stack_executable (void)
|
||
|
if (__mprotect ((void *) page, GL(dl_pagesize),
|
||
|
PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSUP) == 0)
|
||
|
return 0;
|
||
|
- if (errno != EINVAL)
|
||
|
+ if (errno == EACCES) { /* PAX is enabled */
|
||
|
+ return 0;
|
||
|
+ } else if (errno != EINVAL) {
|
||
|
return errno;
|
||
|
+ }
|
||
|
no_growsup = true;
|
||
|
}
|
||
|
# endif
|
||
|
@@ -114,8 +123,11 @@ _dl_make_stack_executable (void)
|
||
|
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.
|