1
0
mirror of https://sourceware.org/git/glibc.git synced 2026-01-06 11:51:29 +03:00

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.
This commit is contained in:
Siddhesh Poyarekar
2013-05-29 21:30:20 +05:30
parent d0501bfbe2
commit b937534868
41 changed files with 220 additions and 103 deletions

View File

@@ -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,