summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorPierre Ynard <linkfanel@yahoo.fr>2013-06-28 21:43:42 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-06-28 21:43:42 +0000
commit0432680e8c2ecd832038387f92b462dea75e94cc (patch)
treee917253c568202b91d781dfbcb05bd2f8d90e6dd /elf
parentce61a2ad2e078a19454411832b167444b6c9ae66 (diff)
downloadglibc-0432680e8c2ecd832038387f92b462dea75e94cc.tar.gz
glibc-0432680e8c2ecd832038387f92b462dea75e94cc.tar.xz
glibc-0432680e8c2ecd832038387f92b462dea75e94cc.zip
Test for mprotect failure in dl-load.c (bug 12492).
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index d53ead4db3..655e38ee4b 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1487,7 +1487,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 protections");
+		  goto call_lose_errno;
+		}
 	      __stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC;
 	      __mprotect ((void *) p, s, PROT_READ);
 	    }