summaryrefslogtreecommitdiff
path: root/libc/elf
diff options
context:
space:
mode:
authormaxim <maxim@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2011-02-28 12:27:54 +0000
committermaxim <maxim@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2011-02-28 12:27:54 +0000
commitda46ece214ac285902c4a95ca3fb2ce1bf51c47e (patch)
tree856f273f0aacdeb09a14cf2a2015b7a129bddc03 /libc/elf
parent06e276822b2d8eee497f28d81492896cedd1b08c (diff)
[BZ #12492]
* elf/dl-load.c (_dl_map_object_from_fd): Add gracious error path for the case when mprotect() fails. git-svn-id: svn://svn.eglibc.org/trunk@13001 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/elf')
-rw-r--r--libc/elf/dl-load.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libc/elf/dl-load.c b/libc/elf/dl-load.c
index b017258ef..4fee639d7 100644
--- a/libc/elf/dl-load.c
+++ b/libc/elf/dl-load.c
@@ -1388,7 +1388,11 @@ cannot allocate TLS data structures for initial thread");
if (__builtin_expect (p + s <= relro_end, 1))
{
/* The variable lies in the region protected by RELRO. */
- __mprotect ((void *) p, s, PROT_READ|PROT_WRITE);
+ if (__mprotect ((void *) p, s, PROT_READ|PROT_WRITE) < 0)
+ {
+ errstring = N_("cannot change memory protection");
+ goto call_lose_errno;
+ }
__stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC;
__mprotect ((void *) p, s, PROT_READ);
}