[compiler-rt] 086af17 - Revert "tsan: mark sigwait as blocking"
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon May 17 03:00:22 PDT 2021
Author: Florian Hahn
Date: 2021-05-17T10:57:59+01:00
New Revision: 086af173998868239aaad7ffd1e79e38dcb2f850
URL: https://github.com/llvm/llvm-project/commit/086af173998868239aaad7ffd1e79e38dcb2f850
DIFF: https://github.com/llvm/llvm-project/commit/086af173998868239aaad7ffd1e79e38dcb2f850.diff
LOG: Revert "tsan: mark sigwait as blocking"
This reverts commit 5dad3d1ba9ad01152be21e94cfbbfb31659ea3e1.
The added test (signal_block2.cpp) does not terminate on some Darwin
configurations and is causing Green Dragon bots to fail. First
failure of the test started in
http://green.lab.llvm.org/green/job/clang-stage1-RA/20767/
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
Removed:
compiler-rt/test/tsan/signal_block2.cpp
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
index 7867fccde3907..205d3dea59e29 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -4032,7 +4032,7 @@ INTERCEPTOR(int, sigwait, __sanitizer_sigset_t *set, int *sig) {
// FIXME: under ASan the call below may write to freed memory and corrupt
// its metadata. See
// https://github.com/google/sanitizers/issues/321.
- int res = COMMON_INTERCEPTOR_BLOCK_REAL(sigwait)(set, sig);
+ int res = REAL(sigwait)(set, sig);
if (!res && sig) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, sig, sizeof(*sig));
return res;
}
@@ -4049,7 +4049,7 @@ INTERCEPTOR(int, sigwaitinfo, __sanitizer_sigset_t *set, void *info) {
// FIXME: under ASan the call below may write to freed memory and corrupt
// its metadata. See
// https://github.com/google/sanitizers/issues/321.
- int res = COMMON_INTERCEPTOR_BLOCK_REAL(sigwaitinfo)(set, info);
+ int res = REAL(sigwaitinfo)(set, info);
if (res > 0 && info) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, info, siginfo_t_sz);
return res;
}
@@ -4068,7 +4068,7 @@ INTERCEPTOR(int, sigtimedwait, __sanitizer_sigset_t *set, void *info,
// FIXME: under ASan the call below may write to freed memory and corrupt
// its metadata. See
// https://github.com/google/sanitizers/issues/321.
- int res = COMMON_INTERCEPTOR_BLOCK_REAL(sigtimedwait)(set, info, timeout);
+ int res = REAL(sigtimedwait)(set, info, timeout);
if (res > 0 && info) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, info, siginfo_t_sz);
return res;
}
diff --git a/compiler-rt/test/tsan/signal_block2.cpp b/compiler-rt/test/tsan/signal_block2.cpp
deleted file mode 100644
index b3c61013a3853..0000000000000
--- a/compiler-rt/test/tsan/signal_block2.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
-
-#include "test.h"
-#include <signal.h>
-#include <string.h>
-#include <sys/time.h>
-
-int test;
-int done;
-int signals_handled;
-pthread_t main_thread;
-pthread_mutex_t mutex;
-pthread_cond_t cond;
-
-void timer_handler(int signum) {
- write(2, "timer_handler\n", strlen("timer_handler\n"));
- if (++signals_handled < 10)
- return;
- switch (test) {
- case 0:
- __atomic_store_n(&done, 1, __ATOMIC_RELEASE);
- (void)pthread_kill(main_thread, SIGUSR1);
- case 1:
- if (pthread_mutex_trylock(&mutex) == 0) {
- __atomic_store_n(&done, 1, __ATOMIC_RELEASE);
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&mutex);
- }
- case 2:
- __atomic_store_n(&done, 1, __ATOMIC_RELEASE);
- }
-}
-
-int main(int argc, char **argv) {
- main_thread = pthread_self();
- pthread_mutex_init(&mutex, 0);
- pthread_cond_init(&cond, 0);
-
- sigset_t sigset;
- sigemptyset(&sigset);
- sigaddset(&sigset, SIGUSR1);
- if (sigprocmask(SIG_BLOCK, &sigset, NULL))
- exit((perror("sigprocmask"), 1));
-
- struct sigaction sa;
- memset(&sa, 0, sizeof(sa));
- sa.sa_handler = &timer_handler;
- if (sigaction(SIGALRM, &sa, NULL))
- exit((perror("setitimer"), 1));
-
- for (test = 0; test < 3; test++) {
- fprintf(stderr, "test %d\n", test);
- struct itimerval timer;
- timer.it_value.tv_sec = 0;
- timer.it_value.tv_usec = 50000;
- timer.it_interval = timer.it_value;
- if (setitimer(ITIMER_REAL, &timer, NULL))
- exit((perror("setitimer"), 1));
-
- switch (test) {
- case 0:
- while (__atomic_load_n(&done, __ATOMIC_ACQUIRE) == 0) {
- int signum;
- sigwait(&sigset, &signum);
- write(2, "sigwait\n", strlen("sigwait\n"));
- }
- case 1:
- pthread_mutex_lock(&mutex);
- while (__atomic_load_n(&done, __ATOMIC_ACQUIRE) == 0) {
- pthread_cond_wait(&cond, &mutex);
- write(2, "pthread_cond_wait\n", strlen("pthread_cond_wait\n"));
- }
- pthread_mutex_unlock(&mutex);
- case 2:
- while (__atomic_load_n(&done, __ATOMIC_ACQUIRE) == 0) {
- }
- }
-
- memset(&timer, 0, sizeof(timer));
- if (setitimer(ITIMER_REAL, &timer, NULL))
- exit((perror("setitimer"), 1));
- done = 0;
- signals_handled = 0;
- }
- fprintf(stderr, "DONE\n");
-}
-
-// CHECK: DONE
More information about the llvm-commits
mailing list