diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-09-19 02:48:59 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-09-19 02:48:59 +0000 |
commit | dcca3fe25f4a57f351ce95253f32e191dfe1167d (patch) | |
tree | 47ed6fa14ac4ec6b14b20e06ffe69e424622ba4f /sysdeps/unix/sysv/linux/dl-execstack.c | |
parent | d72433621f75bce7281adb7060459f6918287926 (diff) | |
download | glibc-dcca3fe25f4a57f351ce95253f32e191dfe1167d.tar.gz glibc-dcca3fe25f4a57f351ce95253f32e191dfe1167d.tar.xz glibc-dcca3fe25f4a57f351ce95253f32e191dfe1167d.zip |
Update.
* sysdeps/unisx/sysv/linux/dl-execstack.c: Get protection flag from memory. * elf/dl-load.c (_dl_map_object_from_fd): Add PROT_EXEC flag to __stack_flags.
Diffstat (limited to 'sysdeps/unix/sysv/linux/dl-execstack.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/dl-execstack.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sysdeps/unix/sysv/linux/dl-execstack.c b/sysdeps/unix/sysv/linux/dl-execstack.c index 3ca9b0b835..c2b964bf7f 100644 --- a/sysdeps/unix/sysv/linux/dl-execstack.c +++ b/sysdeps/unix/sysv/linux/dl-execstack.c @@ -28,6 +28,14 @@ #include "kernel-features.h" +int __stack_prot attribute_hidden attribute_relro +#if _STACK_GROWS_DOWN + = PROT_READ|PROT_WRITE|PROT_GROWSDOWN; +#elif _STACK_GROWS_UP + = PROT_READ|PROT_WRITE|PROT_GROWSUP; +#endif + + int internal_function _dl_make_stack_executable (void **stack_endp) @@ -51,8 +59,7 @@ _dl_make_stack_executable (void **stack_endp) # endif { if (__builtin_expect (__mprotect ((void *) page, GLRO(dl_pagesize), - PROT_READ|PROT_WRITE|PROT_EXEC - |PROT_GROWSDOWN) == 0, 1)) + __stack_prot) == 0, 1)) goto return_success; # if __ASSUME_PROT_GROWSUPDOWN == 0 if (errno == EINVAL) @@ -76,7 +83,7 @@ _dl_make_stack_executable (void **stack_endp) while (1) { if (__mprotect ((void *) page, size, - PROT_READ|PROT_WRITE|PROT_EXEC) == 0) + __stack_prot & ~PROT_GROWSDOWN) == 0) /* We got this chunk changed; loop to do another chunk below. */ page -= size; else |