libc/libpthread: Inject threadsafe locking callbacks for rtld.
authorImre Vadász <imre@vdsz.com>
Sun, 2 Apr 2017 11:50:15 +0000 (13:50 +0200)
committerImre Vadász <imre@vdsz.com>
Sun, 2 Apr 2017 19:05:47 +0000 (21:05 +0200)
commit16fb9086b36e7c7d81241bbd6502634e40346c7b
tree07308a72e08213f79518e3f2030ed28c9622162c
parent7d38e2d20f0f381a65e6be8785419c18946f4cb3
libc/libpthread: Inject threadsafe locking callbacks for rtld.

* Make rtld thread-safe. Add lib/libthread_xu/thread/thr_rtld.c
  to the build and use it to inject pthread based locking callbacks
  for rtld.

* In rtld_lock.c, do the thread_mask_clear(lock->mask); after releasing
  the actual lock, to avoid deadlocks when rtld is called recursively
  from the pthread locking callbacks.
  XXX An alternative solution for this issue would be, to flag the
      libpthread dynamic library as bind_now to avoid the recursive rtld
      calls.
lib/libthread_xu/Makefile
lib/libthread_xu/thread/Makefile.inc
lib/libthread_xu/thread/thr_kern.c
lib/libthread_xu/thread/thr_rtld.c
libexec/rtld-elf/rtld_lock.c