musl/src
Rich Felker 1ad049b7b6 fix race condition in rsyscall handler
the problem: there is a (single-instruction) race condition window
between a thread flagging itself dead and decrementing itself from the
thread count. if it receives the rsyscall signal at this exact moment,
the rsyscall caller will never succeed in signalling enough flags to
succeed, and will deadlock forever. in previous versions of musl, the
about-to-terminate thread masked all signals prior to decrementing
the thread count, but this cost a whole syscall just to account for
extremely rare races.

the solution is a huge hack: rather than blocking in the signal
handler if the thread is dead, modify the signal mask of the saved
context and return in order to prevent further signal handling by the
dead thread. this allows the dead thread to continue decrementing the
thread count (if it had not yet done so) and exiting, even while the
live part of the program blocks for rsyscall.
2011-04-03 13:03:18 -04:00
..
conf fix sem_open and sem_close to obey posix semantics 2011-03-10 21:34:19 -05:00
ctype more header fixes, minor warning fix 2011-02-14 19:33:11 -05:00
dirent global cleanup to use the new syscall interface 2011-03-20 00:16:43 -04:00
env initial check-in, version 0.5.0 2011-02-12 00:22:29 -05:00
errno change errno to static linkage (improves PIC code generation) 2011-02-21 23:00:52 -05:00
exit major stdio overhaul, using readv/writev, plus other changes 2011-03-28 01:14:44 -04:00
fcntl global cleanup to use the new syscall interface 2011-03-20 00:16:43 -04:00
internal simplify calling of timer signal handler 2011-04-03 12:03:58 -04:00
ipc global cleanup to use the new syscall interface 2011-03-20 00:16:43 -04:00
ldso various changes in preparation for dynamic linking support 2011-02-24 16:37:21 -05:00
linux global cleanup to use the new syscall interface 2011-03-20 00:16:43 -04:00
locale fix all implicit conversion between signed/unsigned pointers 2011-03-25 16:34:03 -04:00
malloc avoid over-allocation of brk on first malloc 2011-04-01 23:07:03 -04:00
math Port musl to x86-64. One giant commit! 2011-02-15 07:32:09 -05:00
misc fix all implicit conversion between signed/unsigned pointers 2011-03-25 16:34:03 -04:00
mman global cleanup to use the new syscall interface 2011-03-20 00:16:43 -04:00
multibyte fix all implicit conversion between signed/unsigned pointers 2011-03-25 16:34:03 -04:00
network fix all implicit conversion between signed/unsigned pointers 2011-03-25 16:34:03 -04:00
passwd guard against hard links to non-ordinary-files when reading tcb shadow 2011-02-14 21:15:07 -05:00
prng initial check-in, version 0.5.0 2011-02-12 00:22:29 -05:00
process overhaul cancellation to fix resource leaks and dangerous behavior with signals 2011-03-24 14:18:00 -04:00
regex initial check-in, version 0.5.0 2011-02-12 00:22:29 -05:00
select overhaul cancellation to fix resource leaks and dangerous behavior with signals 2011-03-24 14:18:00 -04:00
setjmp Port musl to x86-64. One giant commit! 2011-02-15 07:32:09 -05:00
signal fix all implicit conversion between signed/unsigned pointers 2011-03-25 16:34:03 -04:00
stat global cleanup to use the new syscall interface 2011-03-20 00:16:43 -04:00
stdio don't disable seeking after first seek failure 2011-04-02 13:55:54 -04:00
stdlib fix all implicit conversion between signed/unsigned pointers 2011-03-25 16:34:03 -04:00
string fix all implicit conversion between signed/unsigned pointers 2011-03-25 16:34:03 -04:00
stub various legacy and linux-specific stuff 2011-03-18 21:52:26 -04:00
temp make mktemp match the historic behavior, and update functions that use it 2011-02-19 09:40:07 -05:00
termios overhaul cancellation to fix resource leaks and dangerous behavior with signals 2011-03-24 14:18:00 -04:00
thread fix race condition in rsyscall handler 2011-04-03 13:03:18 -04:00
time timer threads should sleep and stay asleep... a long time 2011-04-03 12:10:24 -04:00
unistd remove obsolete and useless useconds_t type 2011-04-01 21:10:01 -04:00