From cddcfecfd1a8f91ee1da1c0147a4f07aee1846a0 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 29 Jul 1996 00:18:42 +0000 Subject: Sat Jul 27 13:02:09 1996 Ulrich Drepper * elf/rtld.c (dl_main): Ignore arguments when environment variable LD_TRACE_LOADED_OBJECTS is set. Sun Jul 28 19:42:51 1996 Roland McGrath * sysdeps/generic/dl-sysdep.c (_dl_sysdep_start): Initialize __libc_enable_secure instead of _dl_secure. * sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_start): Likewise. * elf/dl-load.c (_dl_map_object): Check __libc_enable_secure instead of _dl_secure. * elf/Makefile (routines): Add enbl-secure. (elide-routines.so): Here too. * sysdeps/generic/enbl-secure.c: New file. * posix/unistd.h [__USE_GNU]: Declare `__libc_enable_secure' flag. * elf/dl-support.c (_dl_secure): Variable removed. * elf/rtld.c: Likewise. Replace all uses with __libc_enable_secure. Sun Jul 28 19:26:40 1996 David S. Miller * sysdeps/mips/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE): Declare _dl_runtime_resolve with __attribute__ ((unused)) so the compiler doesn't elide it. (elf_machine_rel): Follow Jul 14 change in sysdeps/i386/dl-machine.h. --- elf/rtld.c | 49 +++++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) (limited to 'elf/rtld.c') diff --git a/elf/rtld.c b/elf/rtld.c index 35a94b24cc..3657efdc61 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -30,7 +30,7 @@ Cambridge, MA 02139, USA. */ /* System-specific function to do initial startup for the dynamic linker. After this, file access calls and getenv must work. This is responsible - for setting _dl_secure if we need to be secure (e.g. setuid), + for setting __libc_enable_secure if we need to be secure (e.g. setuid), and for setting _dl_argc and _dl_argv, and then calling _dl_main. */ extern ElfW(Addr) _dl_sysdep_start (void **start_argptr, void (*dl_main) (const ElfW(Phdr) *phdr, @@ -38,7 +38,6 @@ extern ElfW(Addr) _dl_sysdep_start (void **start_argptr, ElfW(Addr) *user_entry)); extern void _dl_sysdep_start_cleanup (void); -int _dl_secure; int _dl_argc; char **_dl_argv; const char *_dl_rpath; @@ -269,7 +268,7 @@ of this helper program; chances are you did not intend to run this program.\n", preloads = NULL; npreloads = 0; - if (! _dl_secure) + if (! __libc_enable_secure) { const char *preloadlist = getenv ("LD_PRELOAD"); if (preloadlist) @@ -340,10 +339,7 @@ of this helper program; chances are you did not intend to run this program.\n", } } - if (mode == normal && getenv ("LD_TRACE_LOADED_OBJECTS") != NULL) - mode = list; - - if (mode != normal) + if (mode != normal || getenv ("LD_TRACE_LOADED_OBJECTS") != NULL) { /* We were run just to list the shared libraries. It is important that we do this before real relocation, because the @@ -366,29 +362,30 @@ of this helper program; chances are you did not intend to run this program.\n", " (0x", bp, ")\n", NULL); } - for (i = 1; i < _dl_argc; ++i) - { - const ElfW(Sym) *ref = NULL; - ElfW(Addr) loadbase = _dl_lookup_symbol (_dl_argv[i], &ref, - &_dl_default_scope[2], - "argument", 0, 0); - char buf[20], *bp; - buf[sizeof buf - 1] = '\0'; - bp = _itoa (ref->st_value, &buf[sizeof buf - 1], 16, 0); - while (&buf[sizeof buf - 1] - bp < sizeof loadbase * 2) - *--bp = '0'; - _dl_sysdep_message (_dl_argv[i], " found at 0x", bp, NULL); - buf[sizeof buf - 1] = '\0'; - bp = _itoa (loadbase, &buf[sizeof buf - 1], 16, 0); - while (&buf[sizeof buf - 1] - bp < sizeof loadbase * 2) - *--bp = '0'; - _dl_sysdep_message (" in object at 0x", bp, "\n", NULL); - } + if (mode != normal) + for (i = 1; i < _dl_argc; ++i) + { + const ElfW(Sym) *ref = NULL; + ElfW(Addr) loadbase = _dl_lookup_symbol (_dl_argv[i], &ref, + &_dl_default_scope[2], + "argument", 0, 0); + char buf[20], *bp; + buf[sizeof buf - 1] = '\0'; + bp = _itoa (ref->st_value, &buf[sizeof buf - 1], 16, 0); + while (&buf[sizeof buf - 1] - bp < sizeof loadbase * 2) + *--bp = '0'; + _dl_sysdep_message (_dl_argv[i], " found at 0x", bp, NULL); + buf[sizeof buf - 1] = '\0'; + bp = _itoa (loadbase, &buf[sizeof buf - 1], 16, 0); + while (&buf[sizeof buf - 1] - bp < sizeof loadbase * 2) + *--bp = '0'; + _dl_sysdep_message (" in object at 0x", bp, "\n", NULL); + } _exit (0); } - lazy = !_dl_secure && *(getenv ("LD_BIND_NOW") ?: "") == '\0'; + lazy = !__libc_enable_secure && *(getenv ("LD_BIND_NOW") ?: "") == '\0'; { /* Now we have all the objects loaded. Relocate them all except for -- cgit 1.4.1