summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-07-29 00:18:42 +0000
committerRoland McGrath <roland@gnu.org>1996-07-29 00:18:42 +0000
commitcddcfecfd1a8f91ee1da1c0147a4f07aee1846a0 (patch)
tree4056b4c91d60d2246ea8a04e3b4a1ee01062f7f9 /elf
parent40fa2c8c2f031aef8463ae219ed6929f90fa1d46 (diff)
downloadglibc-cddcfecfd1a8f91ee1da1c0147a4f07aee1846a0.tar.gz
Sat Jul 27 13:02:09 1996 Ulrich Drepper <drepper@cygnus.com>
* 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 <roland@delasyd.gnu.ai.mit.edu> * 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 <dm@neteng.engr.sgi.com> * 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.
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile5
-rw-r--r--elf/dl-load.c2
-rw-r--r--elf/dl-support.c3
-rw-r--r--elf/rtld.c49
4 files changed, 27 insertions, 32 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 44c510ac43..a19a8b42ba 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -21,14 +21,15 @@
subdir := elf
headers = elf.h elfclass.h link.h dlfcn.h
-routines = $(dl-routines) dl-open dl-close dl-symbol dl-support
+routines = $(dl-routines) dl-open dl-close dl-symbol dl-support \
+ enbl-secure
# The core dynamic linking functions are in libc for the static and
# profiled libraries.
dl-routines = $(addprefix dl-,load cache lookup object reloc deps \
runtime error init fini debug)
# But they are absent from the shared libc, because that code is in ld.so.
-elide-routines.so = $(dl-routines) dl-support
+elide-routines.so = $(dl-routines) dl-support enbl-secure
# ld.so uses those routines, plus some special stuff for being the program
# interpreter and operating independent of libc.
diff --git a/elf/dl-load.c b/elf/dl-load.c
index fc2733252a..8ccc838b2b 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -511,7 +511,7 @@ _dl_map_object (struct link_map *loader, const char *name, int type)
l->l_info[DT_STRTAB]->d_un.d_ptr +
l->l_info[DT_RPATH]->d_un.d_val));
/* Try an environment variable (unless setuid). */
- if (fd == -1 && ! _dl_secure)
+ if (fd == -1 && ! __libc_enable_secure)
trypath (getenv ("LD_LIBRARY_PATH"));
if (fd == -1)
{
diff --git a/elf/dl-support.c b/elf/dl-support.c
index b85d470770..50ebfbfe5a 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -24,8 +24,6 @@ Cambridge, MA 02139, USA. */
/* This file defines some things that for the dynamic linker are defined in
rtld.c and dl-sysdep.c in ways appropriate to bootstrap dynamic linking. */
-int _dl_secure; /* Always honor LD_LIBRARY_PATH. */
-
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
@@ -48,4 +46,3 @@ _dl_sysdep_fatal (void)
{
assert (! "_dl_sysdep_fatal called");
}
-
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