Date: Mon, 1 Dec 2008 21:00:25 +0000 (UTC) From: Alexander Kabaev <kan@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r185531 - head/lib/libthr/thread Message-ID: <200812012100.mB1L0Pec037142@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kan Date: Mon Dec 1 21:00:25 2008 New Revision: 185531 URL: http://svn.freebsd.org/changeset/base/185531 Log: 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 Modified: head/lib/libthr/thread/thr_fork.c Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Mon Dec 1 20:33:22 2008 (r185530) +++ head/lib/libthr/thread/thr_fork.c Mon Dec 1 21:00:25 2008 (r185531) @@ -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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812012100.mB1L0Pec037142>