diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-05 21:38:38 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-05 21:38:38 +0000 |
commit | 12b122f31fda49cca1659805570dd8b90cf8240c (patch) | |
tree | 2e061f4012b060bffc7c7d1cfadbd00c64b7747f /toolchain | |
parent | c45884d8f6172467a4455cff9265e4a48ffcf8de (diff) | |
download | mtk-20170518-12b122f31fda49cca1659805570dd8b90cf8240c.zip mtk-20170518-12b122f31fda49cca1659805570dd8b90cf8240c.tar.gz mtk-20170518-12b122f31fda49cca1659805570dd8b90cf8240c.tar.bz2 |
ld.so: ldd crashes when __LDSO_SEARCH_INTERP_PATH__ is not #defined Since b65c7b2c79debcb9017e31913e01eeaa280106fb, the implicit search path can be disabled by not #defining __LDSO_SEARCH_INTERP_PATH__. This causes _dl_ldsopath to never be set, so it remains NULL. _dl_ldsopath is still used when __LDSO_LDD_SUPPORT__ is #defined, to strip the path off of the beginning of the absolute path to the ld.so interpreter in use for printing. The _dl_strlen will crash with a NULL argument.
Rather than relying on _dl_ldsopath, this change causes ldd to compute
the interpreter's basename directly.
glibc ld.so seems to print the full path to the interpreter without
any computed basename or =>. I personally prefer glibc's behavior, but
to preserve backwards compatibility with uClibc ld.so, the existing
format with the computed basename, =>, and full path is used here. This
enables simpler (and unchanged) text processing in a pipeline.
Signed-off-by: Mark Mentovai <mark at moxienet.com>
SVN-Revision: 23892
Diffstat (limited to 'toolchain')
-rw-r--r-- | toolchain/uClibc/patches-0.9.31/130-ldso-fix-__dl_parse_dynamic_info-segfault.patch | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/toolchain/uClibc/patches-0.9.31/130-ldso-fix-__dl_parse_dynamic_info-segfault.patch b/toolchain/uClibc/patches-0.9.31/130-ldso-fix-__dl_parse_dynamic_info-segfault.patch new file mode 100644 index 0000000..f853d2e --- /dev/null +++ b/toolchain/uClibc/patches-0.9.31/130-ldso-fix-__dl_parse_dynamic_info-segfault.patch @@ -0,0 +1,43 @@ +[PATCH] ld.so: ldd crashes when __LDSO_SEARCH_INTERP_PATH__ is not #defined +Since b65c7b2c79debcb9017e31913e01eeaa280106fb, the implicit search path +can be disabled by not #defining __LDSO_SEARCH_INTERP_PATH__. This +causes _dl_ldsopath to never be set, so it remains NULL. _dl_ldsopath is +still used when __LDSO_LDD_SUPPORT__ is #defined, to strip the path off +of the beginning of the absolute path to the ld.so interpreter in use +for printing. The _dl_strlen will crash with a NULL argument. + +Rather than relying on _dl_ldsopath, this change causes ldd to compute +the interpreter's basename directly. + +glibc ld.so seems to print the full path to the interpreter without +any computed basename or =>. I personally prefer glibc's behavior, but +to preserve backwards compatibility with uClibc ld.so, the existing +format with the computed basename, =>, and full path is used here. This +enables simpler (and unchanged) text processing in a pipeline. + +Signed-off-by: Mark Mentovai <mark at moxienet.com> +--- +ldso/ldso/ldso.c | 12 +++++++++--- +1 files changed, 9 insertions(+), 3 deletions(-) + +--- a/ldso/ldso/ldso.c ++++ b/ldso/ldso/ldso.c +@@ -923,9 +923,15 @@ void _dl_get_ready_to_run(struct elf_res + #ifdef __LDSO_LDD_SUPPORT__ + /* End of the line for ldd.... */ + if (trace_loaded_objects) { +- _dl_dprintf(1, "\t%s => %s (%x)\n", +- rpnt->dyn->libname + _dl_strlen(_dl_ldsopath) + 1, +- rpnt->dyn->libname, DL_LOADADDR_BASE(rpnt->dyn->loadaddr)); ++ /* glibc ld.so/ldd would just do ++ * _dl_dprintf(1, "\t%s (%x)\n", rpnt->dyn->libname, ++ * DL_LOADADDR_BASE(rpnt->dyn->loadaddr)); ++ * but uClibc has always used the => format. */ ++ char *ptmp = _dl_strrchr(rpnt->dyn->libname, '/'); ++ if (ptmp != rpnt->dyn->libname) ++ ++ptmp; ++ _dl_dprintf(1, "\t%s => %s (%x)\n", ptmp, rpnt->dyn->libname, ++ DL_LOADADDR_BASE(rpnt->dyn->loadaddr)); + _dl_exit(0); + } + #endif |