uClibc: update to latest version (rc3 + git changes), contains fixes for ipv6 dns...
[openwrt/svn-archive/archive.git] / toolchain / uClibc / patches-0.9.32 / 130-ldso-fix-__dl_parse_dynamic_info-segfault.patch
1 [PATCH] ld.so: ldd crashes when __LDSO_SEARCH_INTERP_PATH__ is not #defined
2 Since b65c7b2c79debcb9017e31913e01eeaa280106fb, the implicit search path
3 can be disabled by not #defining __LDSO_SEARCH_INTERP_PATH__. This
4 causes _dl_ldsopath to never be set, so it remains NULL. _dl_ldsopath is
5 still used when __LDSO_LDD_SUPPORT__ is #defined, to strip the path off
6 of the beginning of the absolute path to the ld.so interpreter in use
7 for printing. The _dl_strlen will crash with a NULL argument.
8
9 Rather than relying on _dl_ldsopath, this change causes ldd to compute
10 the interpreter's basename directly.
11
12 glibc ld.so seems to print the full path to the interpreter without
13 any computed basename or =>. I personally prefer glibc's behavior, but
14 to preserve backwards compatibility with uClibc ld.so, the existing
15 format with the computed basename, =>, and full path is used here. This
16 enables simpler (and unchanged) text processing in a pipeline.
17
18 Signed-off-by: Mark Mentovai <mark at moxienet.com>
19 ---
20 ldso/ldso/ldso.c | 12 +++++++++---
21 --- a/ldso/ldso/ldso.c
22 +++ b/ldso/ldso/ldso.c
23 @@ -925,9 +925,15 @@ void _dl_get_ready_to_run(struct elf_res
24 #ifdef __LDSO_LDD_SUPPORT__
25 /* End of the line for ldd.... */
26 if (trace_loaded_objects) {
27 - _dl_dprintf(1, "\t%s => %s (%x)\n",
28 - rpnt->dyn->libname + _dl_strlen(_dl_ldsopath) + 1,
29 - rpnt->dyn->libname, DL_LOADADDR_BASE(rpnt->dyn->loadaddr));
30 + /* glibc ld.so/ldd would just do
31 + * _dl_dprintf(1, "\t%s (%x)\n", rpnt->dyn->libname,
32 + * DL_LOADADDR_BASE(rpnt->dyn->loadaddr));
33 + * but uClibc has always used the => format. */
34 + char *ptmp = _dl_strrchr(rpnt->dyn->libname, '/');
35 + if (ptmp != rpnt->dyn->libname)
36 + ++ptmp;
37 + _dl_dprintf(1, "\t%s => %s (%x)\n", ptmp, rpnt->dyn->libname,
38 + DL_LOADADDR_BASE(rpnt->dyn->loadaddr));
39 _dl_exit(0);
40 }
41 #endif