-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "[compiler-rt] Also consider SIGPROF as a synchronous signal" #86416
Revert "[compiler-rt] Also consider SIGPROF as a synchronous signal" #86416
Conversation
Created using spr 1.3.4
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Vitaly Buka (vitalybuka) ChangesReverting #85188 with follow up patches. This reverts commit 362d263. Full diff: https://github.com/llvm/llvm-project/pull/86416.diff 6 Files Affected:
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
index 810ce69663d050..8ffc703b05eace 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
@@ -126,7 +126,6 @@ const int SIGFPE = 8;
const int SIGSEGV = 11;
const int SIGPIPE = 13;
const int SIGTERM = 15;
-const int SIGPROF = 27;
#if defined(__mips__) || SANITIZER_FREEBSD || SANITIZER_APPLE || SANITIZER_NETBSD
const int SIGBUS = 10;
const int SIGSYS = 12;
@@ -2180,8 +2179,7 @@ void sighandler(int sig, __sanitizer_siginfo *info, void *ctx) {
return;
}
// Don't mess with synchronous signals.
- const bool sync = is_sync_signal(sctx, sig, info) ||
- (sig == SIGPROF && thr->is_inited && !thr->is_dead);
+ const bool sync = is_sync_signal(sctx, sig, info);
if (sync ||
// If we are in blocking function, we can safely process it now
// (but check if we are in a recursive interceptor,
diff --git a/compiler-rt/test/tsan/signal_errno.cpp b/compiler-rt/test/tsan/signal_errno.cpp
index 99d4b6d84ca4b0..7e1fd4b0c5a557 100644
--- a/compiler-rt/test/tsan/signal_errno.cpp
+++ b/compiler-rt/test/tsan/signal_errno.cpp
@@ -18,7 +18,7 @@ static void MyHandler(int, siginfo_t *s, void *c) {
static void* sendsignal(void *p) {
barrier_wait(&barrier);
- pthread_kill(mainth, SIGALRM);
+ pthread_kill(mainth, SIGPROF);
return 0;
}
@@ -37,7 +37,7 @@ int main() {
mainth = pthread_self();
struct sigaction act = {};
act.sa_sigaction = &MyHandler;
- sigaction(SIGALRM, &act, 0);
+ sigaction(SIGPROF, &act, 0);
pthread_t th;
pthread_create(&th, 0, sendsignal, 0);
loop();
@@ -46,7 +46,7 @@ int main() {
}
// CHECK: WARNING: ThreadSanitizer: signal handler spoils errno
-// CHECK: Signal 14 handler invoked at:
+// CHECK: Signal 27 handler invoked at:
// CHECK: #0 MyHandler(int, {{(__)?}}siginfo{{(_t)?}}*, void*) {{.*}}signal_errno.cpp
// CHECK: main
// CHECK: SUMMARY: ThreadSanitizer: signal handler spoils errno{{.*}}MyHandler
diff --git a/compiler-rt/test/tsan/signal_reset.cpp b/compiler-rt/test/tsan/signal_reset.cpp
index d76b7e5f3b5f70..82758d882382f6 100644
--- a/compiler-rt/test/tsan/signal_reset.cpp
+++ b/compiler-rt/test/tsan/signal_reset.cpp
@@ -28,12 +28,12 @@ static void* reset(void *p) {
struct sigaction act = {};
for (int i = 0; i < 1000000; i++) {
act.sa_handler = &handler;
- if (sigaction(SIGALRM, &act, 0)) {
+ if (sigaction(SIGPROF, &act, 0)) {
perror("sigaction");
exit(1);
}
act.sa_handler = SIG_IGN;
- if (sigaction(SIGALRM, &act, 0)) {
+ if (sigaction(SIGPROF, &act, 0)) {
perror("sigaction");
exit(1);
}
@@ -44,7 +44,7 @@ static void* reset(void *p) {
int main() {
struct sigaction act = {};
act.sa_handler = SIG_IGN;
- if (sigaction(SIGALRM, &act, 0)) {
+ if (sigaction(SIGPROF, &act, 0)) {
perror("sigaction");
exit(1);
}
@@ -53,7 +53,7 @@ int main() {
t.it_value.tv_sec = 0;
t.it_value.tv_usec = 10;
t.it_interval = t.it_value;
- if (setitimer(ITIMER_REAL, &t, 0)) {
+ if (setitimer(ITIMER_PROF, &t, 0)) {
perror("setitimer");
exit(1);
}
diff --git a/compiler-rt/test/tsan/signal_sync.cpp b/compiler-rt/test/tsan/signal_sync.cpp
index 878b3f3b88b9f0..b529a1859f52a6 100644
--- a/compiler-rt/test/tsan/signal_sync.cpp
+++ b/compiler-rt/test/tsan/signal_sync.cpp
@@ -30,7 +30,7 @@ int main() {
struct sigaction act = {};
act.sa_handler = &handler;
- if (sigaction(SIGVTALRM, &act, 0)) {
+ if (sigaction(SIGPROF, &act, 0)) {
perror("sigaction");
exit(1);
}
@@ -39,7 +39,7 @@ int main() {
t.it_value.tv_sec = 0;
t.it_value.tv_usec = 10;
t.it_interval = t.it_value;
- if (setitimer(ITIMER_VIRTUAL, &t, 0)) {
+ if (setitimer(ITIMER_PROF, &t, 0)) {
perror("setitimer");
exit(1);
}
diff --git a/compiler-rt/test/tsan/signal_thread.cpp b/compiler-rt/test/tsan/signal_thread.cpp
index 7bba8159bf38fc..aa91d1ddeb101c 100644
--- a/compiler-rt/test/tsan/signal_thread.cpp
+++ b/compiler-rt/test/tsan/signal_thread.cpp
@@ -24,7 +24,7 @@ static void* thr(void *p) {
int main() {
struct sigaction act = {};
act.sa_handler = &handler;
- if (sigaction(SIGVTALRM, &act, 0)) {
+ if (sigaction(SIGPROF, &act, 0)) {
perror("sigaction");
exit(1);
}
@@ -33,7 +33,7 @@ int main() {
t.it_value.tv_sec = 0;
t.it_value.tv_usec = 10;
t.it_interval = t.it_value;
- if (setitimer(ITIMER_VIRTUAL, &t, 0)) {
+ if (setitimer(ITIMER_PROF, &t, 0)) {
perror("setitimer");
exit(1);
}
diff --git a/compiler-rt/test/tsan/signal_thread2.cpp b/compiler-rt/test/tsan/signal_thread2.cpp
index 5236628e13b60a..9bde4f70b39d81 100644
--- a/compiler-rt/test/tsan/signal_thread2.cpp
+++ b/compiler-rt/test/tsan/signal_thread2.cpp
@@ -40,7 +40,7 @@ static void *thr(void *p) {
int main() {
struct sigaction act = {};
act.sa_handler = &handler;
- if (sigaction(SIGALRM, &act, 0)) {
+ if (sigaction(SIGPROF, &act, 0)) {
perror("sigaction");
exit(1);
}
@@ -49,7 +49,7 @@ int main() {
t.it_value.tv_sec = 0;
t.it_value.tv_usec = 10;
t.it_interval = t.it_value;
- if (setitimer(ITIMER_REAL, &t, 0)) {
+ if (setitimer(ITIMER_PROF, &t, 0)) {
perror("setitimer");
exit(1);
}
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
✅ With the latest revision this PR passed the Python code formatter. |
Reverting #85188 with follow up patches.
This reverts commit 362d263.
This reverts commit c9bdeab.
This reverts commit 6bc6e1a.
This reverts commit 01fa550.
This reverts commit ddcbab3.