From 5bf02fe0f63a73ea16e53803977fbef08941c170 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 30 Mar 2018 20:41:41 +0300 Subject: [PATCH] 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. --- pthread_stop_world.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 */ -- 2.40.0