freebsd-dev/libexec/rtld-elf
Konstantin Belousov 5734c46c68 _rtld_bind() read-locks the bind lock, and possible plt resolution
from the dispatcher would also acquire bind lock in read mode, which
is the supported operation. plt is explicitely designed to allow safe
multithreaded updates, so the shared lock do not cause problems.

The error in r228435 is that it allows read lock acquisition after the
write lock for the bind block.  If we dlopened the shared object that
contains IRELATIVE or jump slot which target is STT_GNU_IFUNC, then
possible recursive plt resolve from the dispatcher would cause it.

Postpone the resolution for irelative/ifunc right before initializers
are called, and drop bind lock around calls to dispatcher.  Use
initlist to iterate over the objects instead of the ->next, due to
drop of the bind lock in iteration.

For i386/reloc.c:reloc_iresolve(), fix calculation of the dispatch
function address for dso, by taking into account possible non-zero
relocbase.

MFC after:	3 weeks
2011-12-14 16:47:53 +00:00
..
amd64 _rtld_bind() read-locks the bind lock, and possible plt resolution 2011-12-14 16:47:53 +00:00
arm Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to 2011-12-12 11:03:14 +00:00
i386 _rtld_bind() read-locks the bind lock, and possible plt resolution 2011-12-14 16:47:53 +00:00
ia64 Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to 2011-12-12 11:03:14 +00:00
mips Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to 2011-12-12 11:03:14 +00:00
powerpc Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to 2011-12-12 11:03:14 +00:00
powerpc64 Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to 2011-12-12 11:03:14 +00:00
sparc64 Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to 2011-12-12 11:03:14 +00:00
debug.c Rtld links with the specially built pic static libc library to get some 2011-08-24 20:05:13 +00:00
debug.h Use C99's varadic macro syntax instead of gcc's. 2006-03-28 18:26:47 +00:00
libmap.c Fix a malloc overrun in 32-bit compat libmap lookup code. 2006-01-31 06:08:28 +00:00
libmap.h Description from Dan: 2005-02-04 02:46:41 +00:00
Makefile Rtld links with the specially built pic static libc library to get some 2011-08-24 20:05:13 +00:00
malloc.c Rtld links with the specially built pic static libc library to get some 2011-08-24 20:05:13 +00:00
map_object.c Restore the writing of the .bss sections of the dsos (not the main 2011-09-20 21:49:54 +00:00
rtld_lock.c Rtld links with the specially built pic static libc library to get some 2011-08-24 20:05:13 +00:00
rtld_lock.h Implement support for ELF filters in rtld. Both normal and auxillary 2010-12-25 08:51:20 +00:00
rtld_printf.c Do not use the function pointers for the internal operation of rtld_printf() 2011-09-06 10:21:33 +00:00
rtld_printf.h Rtld links with the specially built pic static libc library to get some 2011-08-24 20:05:13 +00:00
rtld_tls.h Add support for Thread Local Storage. 2004-08-03 08:51:00 +00:00
rtld.1 Implement support for ELF filters in rtld. Both normal and auxillary 2010-12-25 08:51:20 +00:00
rtld.c _rtld_bind() read-locks the bind lock, and possible plt resolution 2011-12-14 16:47:53 +00:00
rtld.h Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to 2011-12-12 11:03:14 +00:00
Symbol.map Remove a hack made obsolete by the binutils 2.17 merge. 2011-02-20 16:16:42 +00:00
xmalloc.c Rtld links with the specially built pic static libc library to get some 2011-08-24 20:05:13 +00:00