about summary refs log tree commit diff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-20 15:15:23 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-20 15:15:23 +0000
commit703ccc12453bbe0111b758637445386ed834b8ae (patch)
treec29a93c1bf4cc9d9dd7d002780d9b3f0228974c6 /elf/dl-load.c
parent664e7d93f93d421225a115a433d0dbbc40444daa (diff)
downloadglibc-703ccc12453bbe0111b758637445386ed834b8ae.tar.gz
glibc-703ccc12453bbe0111b758637445386ed834b8ae.tar.xz
glibc-703ccc12453bbe0111b758637445386ed834b8ae.zip
(_dl_map_object_from_fd): Add caller check.
Diffstat (limited to 'elf/dl-load.c')
-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 fad456f02c..e4f85a9cc8 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -35,6 +35,7 @@
 #include <abi-tag.h>
 #include <dl-osinfo.h>
 #include <stackinfo.h>
+#include <caller.h>
 
 #include <dl-dst.h>
 
@@ -1293,7 +1294,10 @@ cannot allocate TLS data structures for initial thread");
 	  size_t s = (uintptr_t) &__stack_prot - p + sizeof (int);
 
 	  __mprotect ((void *) p, s, PROT_READ|PROT_WRITE);
-	  __stack_prot |= PROT_EXEC;
+	  if (__builtin_expect (__check_caller (RETURN_ADDRESS (0),
+						allow_ldso|allow_libc) == 0,
+				0))
+	    __stack_prot |= PROT_EXEC;
 	  __mprotect ((void *) p, s, PROT_READ);
 	}
       else