From 703ccc12453bbe0111b758637445386ed834b8ae Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 20 Sep 2004 15:15:23 +0000 Subject: (_dl_map_object_from_fd): Add caller check. --- elf/dl-load.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'elf/dl-load.c') 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 #include #include +#include #include @@ -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 -- cgit v1.2.3