summaryrefslogtreecommitdiff
path: root/libc
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
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')
-rw-r--r--libc/ChangeLog.eglibc6
-rw-r--r--libc/elf/dl-load.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/libc/ChangeLog.eglibc b/libc/ChangeLog.eglibc
index 0378e4f63..e794928a9 100644
--- a/libc/ChangeLog.eglibc
+++ b/libc/ChangeLog.eglibc
@@ -1,3 +1,9 @@
+2011-02-28 Pierre Ynard <linkfanel@yahoo.fr>
+
+ [BZ #12492]
+ * elf/dl-load.c (_dl_map_object_from_fd): Add gracious error path for
+ the case when mprotect() fails.
+
2011-02-28 Denis Zaitceff <zaitceff@gmail.com>
* elf/dl-lookup.c (GLRO_dl_debug_mask): Apply the forgotten one.
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);
}