musl/src/ldso
Rich Felker 69003e0590 fix crash in dynamic linker when certain copy relocations are unsatisfied
STB_WEAK is only a weak reference for undefined symbols (those with a
section of SHN_UNDEF). otherwise, it's a weak definition. normally
this distinction would not matter, since a relocation referencing a
symbol that also provides a definition (not SHN_UNDEF) will always
succeed in finding the referenced symbol itself. however, in the case
of copy relocations, the referenced symbol itself is ignored in order
to search for another symbol to copy from, and thus it's possible that
no definition is found. in this case, if the symbol being resolved
happened to be a weak definition, it was misinterpreted as a weak
reference, suppressing the error path and causing a crash when the
copy relocation was performed with a null source pointer passed to
memcpy.

there are almost certainly still situations in which invalid
combinations of symbol and relocation types can cause the dynamic
linker to crash (this is pretty much inevitable), but the intent is
that crashes not be possible for symbol/relocation tables produced by
a valid linker.
2014-01-21 00:36:35 -05:00
..
arm add ldd and main program loading support to dynamic linker 2012-05-27 16:01:44 -04:00
i386 add ldd and main program loading support to dynamic linker 2012-05-27 16:01:44 -04:00
microblaze fix dynamic linker entry point for microblaze 2013-12-14 19:51:48 -05:00
mips fix dlsym asm for mips 2012-11-08 14:31:49 -05:00
powerpc arg-skipping code for powerpc dynamic linker 2012-11-17 17:25:17 -05:00
x86_64 add ldd and main program loading support to dynamic linker 2012-05-27 16:01:44 -04:00
dl_iterate_phdr.c add dl_iterate_phdr interface 2012-10-31 21:27:48 -04:00
dladdr.c const-qualify the address argument to dladdr 2014-01-06 22:03:38 -05:00
dlinfo.c include cleanups: remove unused headers and add feature test macros 2013-12-12 05:09:18 +00:00
dlsym.c use restrict everywhere it's required by c99 and/or posix 2008 2012-09-06 22:44:55 -04:00
dynlink.c fix crash in dynamic linker when certain copy relocations are unsatisfied 2014-01-21 00:36:35 -05:00
start.c various changes in preparation for dynamic linking support 2011-02-24 16:37:21 -05:00