reorder thread list unlink in pthread_exit after all locks
authorRich Felker <dalias@aerifal.cx>
Fri, 22 May 2020 21:35:14 +0000 (17:35 -0400)
committerRich Felker <dalias@aerifal.cx>
Fri, 22 May 2020 21:39:57 +0000 (17:39 -0400)
commit4d5aa20a94a2d3fae3e69289dc23ecafbd0c16c4
tree8eb6e667cd532a4a01e5cf4045dc71d11943b4ad
parentcabc36969bce739e86ecac250d286b0bda6aa88e
reorder thread list unlink in pthread_exit after all locks

since the backend for LOCK() skips locking if single-threaded, it's
unsafe to make the process appear single-threaded before the last use
of lock.

this fixes potential unsynchronized access to a linked list via
__dl_thread_cleanup.
src/thread/pthread_create.c