summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-11-06 00:16:32 +0000
committerUlrich Drepper <drepper@redhat.com>2001-11-06 00:16:32 +0000
commitc95f3fd42ed8d7660e817cf74b0883d7563d8102 (patch)
tree1395eae94b48080a50cbefa142906ce445fdae7f /elf
parentea41b9267dbd64faec6630e45fac87afb663ec11 (diff)
Update.
* elf/elf.h: Add dynamic tag definitions for prelinking. * elf/rtld.c (process_envvars): Avoid using array of string pointers. Rewrite code to remove environment varables for SUID binaries. Small optimization in LD_PROFILE handling. * sysdeps/generic/unsecvars.h: Adjust format for process_envvars changes. * sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise. * sysdeps/generic/dl-sysdep.c: Don't initialize _dl_cpuclock_offset.
Diffstat (limited to 'elf')
-rw-r--r--elf/elf.h5
-rw-r--r--elf/rtld.c41
2 files changed, 19 insertions, 27 deletions
diff --git a/elf/elf.h b/elf/elf.h
index cb1a7af829..82c7936bad 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -663,6 +663,9 @@ typedef struct
Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's
approach. */
#define DT_VALRNGLO 0x6ffffd00
+#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */
+#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */
+#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */
#define DT_CHECKSUM 0x6ffffdf8
#define DT_PLTPADSZ 0x6ffffdf9
#define DT_MOVEENT 0x6ffffdfa
@@ -680,6 +683,8 @@ typedef struct
If any adjustment is made to the ELF object after it has been
built these entries will need to be adjusted. */
#define DT_ADDRRNGLO 0x6ffffe00
+#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */
+#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */
#define DT_CONFIG 0x6ffffefa /* Configuration information. */
#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */
#define DT_AUDIT 0x6ffffefc /* Object auditing. */
diff --git a/elf/rtld.c b/elf/rtld.c
index 47ac3e3cb6..e7d1e834b6 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1345,7 +1345,7 @@ process_envvars (enum mode *modep)
}
/* Which shared object shall be profiled. */
- if (memcmp (envline, "PROFILE", 7) == 0)
+ if (memcmp (envline, "PROFILE", 7) == 0 && envline[8] != '\0')
_dl_profile = &envline[8];
break;
@@ -1430,38 +1430,27 @@ process_envvars (enum mode *modep)
variables. */
if (__builtin_expect (__libc_enable_secure, 0))
{
- static const char *unsecure_envvars[] =
- {
- UNSECURE_ENVVARS,
+ static const char unsecure_envvars[] =
#ifdef EXTRA_UNSECURE_ENVVARS
EXTRA_UNSECURE_ENVVARS
#endif
- };
- size_t cnt;
-
- if (preloadlist != NULL)
- unsetenv ("LD_PRELOAD");
- if (library_path != NULL)
- unsetenv ("LD_LIBRARY_PATH");
- if (_dl_origin_path != NULL)
- unsetenv ("LD_ORIGIN_PATH");
- if (debug_output != NULL)
- unsetenv ("LD_DEBUG_OUTPUT");
- if (_dl_profile != NULL)
- unsetenv ("LD_PROFILE");
-
- for (cnt = 0;
- cnt < sizeof (unsecure_envvars) / sizeof (unsecure_envvars[0]);
- ++cnt)
- unsetenv (unsecure_envvars[cnt]);
+ UNSECURE_ENVVARS;
+ const char *nextp;
+
+ nextp = unsecure_envvars;
+ do
+ {
+ unsetenv (nextp);
+ nextp = (char *) rawmemchr (nextp, '\0') + 1;
+ }
+ while (*nextp != '\0');
if (__access ("/etc/suid-debug", F_OK) != 0)
unsetenv ("MALLOC_CHECK_");
}
- /* The name of the object to profile cannot be empty. */
- if (_dl_profile != NULL && *_dl_profile == '\0')
- _dl_profile = NULL;
+ /* The caller wants this information. */
+ *modep = mode;
/* If we have to run the dynamic linker in debugging mode and the
LD_DEBUG_OUTPUT environment variable is given, we write the debug
@@ -1487,8 +1476,6 @@ process_envvars (enum mode *modep)
/* We use standard output if opening the file failed. */
_dl_debug_fd = STDOUT_FILENO;
}
-
- *modep = mode;
}