Skip to content

Commit

Permalink
2005-02-07 Ulrich Drepper <drepper@redhat.com>
Browse files Browse the repository at this point in the history
	* elf/dl-load.c (_dl_map_object_from_fd): Makre sure registers are
	set correctly.
  • Loading branch information
Roland McGrath committed Feb 16, 2005
1 parent 57776c9 commit 8d93f18
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions elf/dl-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <dl-osinfo.h>
#include <stackinfo.h>
#include <caller.h>
#include <sysdep.h>

#include <dl-dst.h>

Expand Down Expand Up @@ -105,13 +106,11 @@ ELF_PREFERRED_ADDRESS_DATA;


int __stack_prot attribute_hidden attribute_relro
= (PROT_READ|PROT_WRITE
#if _STACK_GROWS_DOWN && defined PROT_GROWSDOWN
|PROT_GROWSDOWN
= PROT_GROWSDOWN;
#elif _STACK_GROWS_UP && defined PROT_GROWSUP
|PROT_GROWSUP
= PROT_GROWSUP;
#endif
);


/* Type for the buffer we put the ELF header and hopefully the program
Expand Down Expand Up @@ -1327,12 +1326,16 @@ cannot allocate TLS data structures for initial thread");
if (__builtin_expect (__check_caller (RETURN_ADDRESS (0),
allow_ldso|allow_libc) == 0,
0))
__stack_prot |= PROT_EXEC;
__stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC;
__mprotect ((void *) p, s, PROT_READ);
}
else
#endif
__stack_prot |= PROT_EXEC;
__stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC;

#ifdef check_consistency
check_consistency ();
#endif

errval = (*GL(dl_make_stack_executable_hook)) (stack_endp);
if (errval)
Expand Down

0 comments on commit 8d93f18

Please sign in to comment.