aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-05-29 21:30:20 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-05-29 21:34:12 +0530
commitb937534868c8d7aec3b6d645bf5fd657bbfccd42 (patch)
tree18936faaea13f35bcaf698f97447752c0e1c4567 /elf/dl-version.c
parentFix ChangeLog formatting (diff)
downloadglibc-b937534868c8d7aec3b6d645bf5fd657bbfccd42.tar.gz
glibc-b937534868c8d7aec3b6d645bf5fd657bbfccd42.tar.bz2
glibc-b937534868c8d7aec3b6d645bf5fd657bbfccd42.zip
Avoid crashing in LD_DEBUG when program name is unavailable
Resolves: #15465 The program name may be unavailable if the user application tampers with argc and argv[]. Some parts of the dynamic linker caters for this while others don't, so this patch consolidates the check and fallback into a single macro and updates all users.
Diffstat (limited to 'elf/dl-version.c')
-rw-r--r--elf/dl-version.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/elf/dl-version.c b/elf/dl-version.c
index c02baa0600..62be4aef75 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -85,7 +85,7 @@ match_symbol (const char *name, Lmid_t ns, ElfW(Word) hash, const char *string,
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS, 0))
_dl_debug_printf ("\
checking for version `%s' in file %s [%lu] required by file %s [%lu]\n",
- string, map->l_name[0] ? map->l_name : rtld_progname,
+ string, DSO_FILENAME (map->l_name),
map->l_ns, name, ns);
if (__builtin_expect (map->l_info[VERSYMIDX (DT_VERDEF)] == NULL, 0))
@@ -162,7 +162,7 @@ no version information available (required by ", name, ")");
name, ")");
result = 1;
call_cerror:
- _dl_signal_cerror (0, map->l_name[0] ? map->l_name : rtld_progname,
+ _dl_signal_cerror (0, DSO_FILENAME (map->l_name),
N_("version lookup error"), errstring);
return result;
}
@@ -210,7 +210,7 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
&buf[sizeof (buf) - 1], 10, 0),
" of Verneed record\n");
call_error:
- _dl_signal_error (errval, *map->l_name ? map->l_name : rtld_progname,
+ _dl_signal_error (errval, DSO_FILENAME (map->l_name),
NULL, errstring);
}
@@ -234,8 +234,7 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
while (1)
{
/* Match the symbol. */
- result |= match_symbol ((*map->l_name
- ? map->l_name : rtld_progname),
+ result |= match_symbol (DSO_FILENAME (map->l_name),
map->l_ns, aux->vna_hash,
strtab + aux->vna_name,
needed->l_real, verbose,