While investigating bug 4578 I ran into a deadlock due to dl_load_write_lock not being reinitialised for the child process during a fork. If one thread calls dl_iterate_phdr() and then another thread calls fork() then the child process ends up with a dl_load_write_lock that is already locked by the thread that called dl_iterate_phdr(). The fork call already reinitialises dl_load_lock but reinitialisation of dl_load_write_lock was not added to fork when that new lock was created. I have created and attached a test case that recreates this and a patch to fix it.
Created attachment 8806 [details] test case
Created attachment 8807 [details] patch
In a multi-threaded process a forked child may only call async-signal-safe functions.
Mailing list discussion: https://sourceware.org/ml/libc-alpha/2017-10/msg00265.html