diff options
author | kan <kan@FreeBSD.org> | 2008-12-01 21:00:25 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2008-12-01 21:00:25 +0000 |
commit | 5542bcbfb08273f9f8b29628ee1e298bd956661c (patch) | |
tree | c467eaf939ad5732ac5b5657c1bf512e8f76eeb1 /lib/libthr/thread/thr_fork.c | |
parent | 9ce9c6455336df8584cd3ea4f1f108d07a3b008f (diff) | |
download | FreeBSD-src-5542bcbfb08273f9f8b29628ee1e298bd956661c.zip FreeBSD-src-5542bcbfb08273f9f8b29628ee1e298bd956661c.tar.gz |
Invoke _rtld_atfork_post earlier, before we reinitialize rtld locks
by switching into single-thread mode.
libthr ignores broken use of lock bitmaps used by default rtld locking
implementation, this in turn turns lock handoff in _rtld_thread_init
into NOP. This in turn makes child processes of forked multi-threaded
programs to run with _thr_signal_block still in effect, with most
signals blocked.
Reported by: phk, kib
Diffstat (limited to 'lib/libthr/thread/thr_fork.c')
-rw-r--r-- | lib/libthr/thread/thr_fork.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c index 18a9a05..0288dc2 100644 --- a/lib/libthr/thread/thr_fork.c +++ b/lib/libthr/thread/thr_fork.c @@ -158,6 +158,9 @@ _fork(void) /* clear other threads locked us. */ _thr_umutex_init(&curthread->lock); _thr_umutex_init(&_thr_atfork_lock); + + if (unlock_malloc) + _rtld_atfork_post(rtld_locks); _thr_setthreaded(0); /* reinitialize libc spinlocks. */ @@ -170,10 +173,8 @@ _fork(void) /* Ready to continue, unblock signals. */ _thr_signal_unblock(curthread); - if (unlock_malloc) { - _rtld_atfork_post(rtld_locks); + if (unlock_malloc) _malloc_postfork(); - } /* Run down atfork child handlers. */ TAILQ_FOREACH(af, &_thr_atfork_list, qe) { |