From: Ivan Maidanski Date: Fri, 30 Mar 2018 17:41:41 +0000 (+0300) Subject: Unblock only GC signals in suspend_handler (TSan) X-Git-Tag: v8.0.0~263 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5bf02fe0f63a73ea16e53803977fbef08941c170;p=gc Unblock only GC signals in suspend_handler (TSan) Issue #181 (bdwgc). * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && THREAD_SANITIZER] (GC_suspend_handler_inner): Replace pthread_sigmask(SIG_SETMASK) to pthread_sigmask(SIG_UNBLOCK) with the set with GC_sig_suspend and GC_sig_thr_restart signals. --- diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 79602e0e..bd67c5f3 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -334,8 +334,12 @@ STATIC void GC_suspend_handler_inner(ptr_t dummy GC_ATTR_UNUSED, { sigset_t set; sigemptyset(&set); - if (pthread_sigmask(SIG_SETMASK, &set, NULL) != 0) - ABORT("pthread_sigmask(SIG_SETMASK) failed"); + GC_ASSERT(GC_sig_suspend != SIGNAL_UNSET); + GC_ASSERT(GC_sig_thr_restart != SIGNAL_UNSET); + sigaddset(&set, GC_sig_suspend); + sigaddset(&set, GC_sig_thr_restart); + if (pthread_sigmask(SIG_UNBLOCK, &set, NULL) != 0) + ABORT("pthread_sigmask failed in suspend handler"); } # endif /* Tell the thread that wants to stop the world that this */