From 2abf9ff11384a47dc456c138a8faf6b1469aac2b Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 23 Sep 2003 12:07:26 +0000 Subject: * sysdeps/i386/dl-machine.h (RTLD_START): Set __libc_stack_end before calling _dl_start, using GOTOFF access. * configure.in (libc_cv_z_execstack): New check. * configure: Regenerated. * config.make.in (have-z-execstack): New variable set by it. * elf/tst-execstack.c: New file. * elf/tst-execstack-mod.c: New file. * elf/tst-execstack-needed.c: New file. * elf/Makefile (tests-execstack-yes, modules-execstack-yes): New variables. (tests, modules-names): Conditionally include them. (distribute): Add tst-execstack-mod.c here. ($(objpfx)tst-execstack, $(objpfx)tst-execstack.out): New targets. (LDFLAGS-tst-execstack, LDFLAGS-tst-execstack-mod): New variables. ($(objpfx)tst-execstack-needed): New target. (LDFLAGS-tst-execstack-needed): New variable. * sysdeps/generic/ldsodefs.h (struct rtld_global): Add _dl_stack_flags and _dl_make_stack_executable_hook. Declare _dl_make_stack_executable. * elf/rtld.c (_rtld_global): Add initializer for _dl_stack_flags. (dl_main): Reset _dl_stack_flags according to PT_GNU_STACK phdr. Initialize _dl_make_stack_executable_hook. * elf/dl-support.c: Define those new variables. (_dl_non_dynamic_init): Scan phdrs for PT_GNU_STACK. (_dl_phdr): Fix type. * elf/dl-load.c (_dl_map_object_from_fd): Grok PT_GNU_STACK phdr and enable execute permission for the stack if necessary. * sysdeps/generic/dl-execstack.c: New file. * elf/Makefile (dl-routines): Add it. * elf/Versions (ld: GLIBC_PRIVATE): Add _dl_make_stack_executable. * sysdeps/unix/sysv/linux/dl-execstack.c: New file. --- sysdeps/i386/dl-machine.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sysdeps/i386') diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 34019b89bb..9e84e2c059 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -276,18 +276,17 @@ _dl_runtime_profile:\n\ .globl _start\n\ .globl _dl_start_user\n\ _start:\n\ + # Point %ebx at the GOT.\n\ + call 0b\n\ + addl $_GLOBAL_OFFSET_TABLE_, %ebx\n\ # Note that _dl_start gets the parameter in %eax.\n\ movl %esp, %eax\n\ + # Store the highest stack address\n\ + movl %eax, __libc_stack_end@GOTOFF(%ebx)\n\ call _dl_start\n\ _dl_start_user:\n\ # Save the user entry point address in %edi.\n\ movl %eax, %edi\n\ - # Point %ebx at the GOT.\n\ - call 0b\n\ - addl $_GLOBAL_OFFSET_TABLE_, %ebx\n\ - # Store the highest stack address\n\ - movl __libc_stack_end@GOT(%ebx), %eax\n\ - movl %esp, (%eax)\n\ # See if we were run as a command with the executable file\n\ # name as an extra leading argument.\n\ movl _dl_skip_args@GOTOFF(%ebx), %eax\n\ -- cgit 1.4.1