summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_mac.cc
diff options
context:
space:
mode:
authorKuba Mracek <mracek@apple.com>2017-07-05 22:17:44 +0000
committerKuba Mracek <mracek@apple.com>2017-07-05 22:17:44 +0000
commitf863c64e6e6ec4b46420bd546dea312c0bb3e2f5 (patch)
tree8ed16283330773501caa7b1e5ca60eecd2a8cb6a /lib/sanitizer_common/sanitizer_mac.cc
parentf339952e6e43368ab0f4783bc330a4e5240a4024 (diff)
[tsan] Use pthread_sigmask instead of sigprocmask to block signals in a thread on Darwin
On Darwin, sigprocmask changes the signal mask for the entire process. This has some unwanted consequences, because e.g. internal_start_thread wants to disable signals only in the current thread (to make the new thread inherit the signal mask), which is currently broken on Darwin. This patch switches to pthread_sigmask. Differential Revision: https://reviews.llvm.org/D35016 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307212 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_mac.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_mac.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_mac.cc b/lib/sanitizer_common/sanitizer_mac.cc
index b48238106..2a13fee05 100644
--- a/lib/sanitizer_common/sanitizer_mac.cc
+++ b/lib/sanitizer_common/sanitizer_mac.cc
@@ -191,7 +191,8 @@ void internal_sigfillset(__sanitizer_sigset_t *set) { sigfillset(set); }
uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
__sanitizer_sigset_t *oldset) {
- return sigprocmask(how, set, oldset);
+ // Don't use sigprocmask here, because it affects all threads.
+ return pthread_sigmask(how, set, oldset);
}
// Doesn't call pthread_atfork() handlers (but not available on 10.6).