glibc/sysdeps
Florian Weimer 669ff911e2 nptl: Avoid fork handler lock for async-signal-safe fork [BZ #24161]
Commit 27761a1042 ("Refactor atfork
handlers") introduced a lock, atfork_lock, around fork handler list
accesses.  It turns out that this lock occasionally results in
self-deadlocks in malloc/tst-mallocfork2:

(gdb) bt
#0  __lll_lock_wait_private ()
    at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:63
#1  0x00007f160c6f927a in __run_fork_handlers (who=(unknown: 209394016),
    who@entry=atfork_run_prepare) at register-atfork.c:116
#2  0x00007f160c6b7897 in __libc_fork () at ../sysdeps/nptl/fork.c:58
#3  0x00000000004027d6 in sigusr1_handler (signo=<optimized out>)
    at tst-mallocfork2.c:80
#4  sigusr1_handler (signo=<optimized out>) at tst-mallocfork2.c:64
#5  <signal handler called>
#6  0x00007f160c6f92e4 in __run_fork_handlers (who=who@entry=atfork_run_parent)
    at register-atfork.c:136
#7  0x00007f160c6b79a2 in __libc_fork () at ../sysdeps/nptl/fork.c:152
#8  0x0000000000402567 in do_test () at tst-mallocfork2.c:156
#9  0x0000000000402dd2 in support_test_main (argc=1, argv=0x7ffc81ef1ab0,
    config=config@entry=0x7ffc81ef1970) at support_test_main.c:350
#10 0x0000000000402362 in main (argc=<optimized out>, argv=<optimized out>)
    at ../support/test-driver.c:168

If no locking happens in the single-threaded case (where fork is
expected to be async-signal-safe), this deadlock is avoided.
(pthread_atfork is not required to be async-signal-safe, so a fork
call from a signal handler interrupting pthread_atfork is not
a problem.)
2019-02-08 12:46:19 +01:00
..
aarch64 aarch64: Optimized memchr specific to AmpereComputing emag 2019-02-01 08:14:21 -05:00
alpha alpha: Fix __remqu corrupting $f3 register 2019-01-24 10:28:13 -08:00
arm arm: Use "nr" constraint for Systemtap probes [BZ #24164] 2019-02-05 13:01:08 +01:00
csky Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
generic arm: Use "nr" constraint for Systemtap probes [BZ #24164] 2019-02-05 13:01:08 +01:00
gnu Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
hppa Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
htl hurd: advertise *_setpshared as not supported 2019-01-02 22:21:34 +01:00
hurd Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
i386 Fix handling of collating elements in fnmatch (bug 17396, bug 16976) 2019-02-04 15:45:02 +01:00
ia64 Fix a few typos in comments 2019-01-12 13:44:51 +00:00
ieee754 Avoid "inline" after return type in function definitions. 2019-02-06 17:16:43 +00:00
init_array Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
m68k Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
mach hurd: Check at_flags passed to faccessat 2019-01-22 22:47:10 +01:00
microblaze Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
mips Update MIPS libm-test-ulps. 2019-01-02 17:25:33 +00:00
nios2 Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
nptl nptl: Avoid fork handler lock for async-signal-safe fork [BZ #24161] 2019-02-08 12:46:19 +01:00
posix Cleanup clock_*time includes 2019-02-01 12:24:52 +00:00
powerpc powerpc: Fix tiny bug in strncmp.c 2019-01-16 12:18:58 -02:00
pthread Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
riscv RISC-V: Update nofpu ULPs 2019-01-24 13:55:05 -05:00
s390 S390: Fix introduction of __wmemcmp and weak wmemcmp symbols. 2019-02-06 09:10:31 +01:00
sh Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
sparc soft-fp: Properly check _FP_W_TYPE_SIZE [BZ #24066] 2019-01-07 09:04:39 -08:00
unix Linux: Add gettid system call wrapper [BZ #6399] 2019-02-08 11:27:55 +01:00
wordsize-32 Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
wordsize-64 Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
x86 Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
x86_64 Fix handling of collating elements in fnmatch (bug 17396, bug 16976) 2019-02-04 15:45:02 +01:00