about summary refs log tree commit diff
path: root/crt/rcrt1.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2020-11-19 16:09:16 -0500
committerRich Felker <dalias@aerifal.cx>2020-11-19 16:09:16 -0500
commitd26e0774a59bb7245b205bc8e7d8b35cc2037095 (patch)
tree1f9921e83c473b5b1c595c99c20801d7df4d4564 /crt/rcrt1.c
parent167390f05564e0a4d3fcb4329377fd7743267560 (diff)
downloadmusl-d26e0774a59bb7245b205bc8e7d8b35cc2037095.tar.gz
musl-d26e0774a59bb7245b205bc8e7d8b35cc2037095.tar.xz
musl-d26e0774a59bb7245b205bc8e7d8b35cc2037095.zip
pthread_exit: don't __vm_wait under thread list lock
the __vm_wait operation can delay forward progress arbitrarily long if
a thread holding the lock is interrupted by a signal. in a worst case
this can deadlock. any critical section holding the thread list lock
must respect lock ordering contracts and must not take any lock which
is not AS-safe.

to fix, move the determination of thread joinable/detached state to
take place before the killlock and thread list lock are taken. this
requires reverting the atomic state transition if we determine that
the exiting thread is the last thread and must call exit, but that's
easy to do since it's a single-threaded context with application
signals blocked.
Diffstat (limited to 'crt/rcrt1.c')
0 files changed, 0 insertions, 0 deletions