Skip to content

Commit 4acd84e

Browse files
authored
Revert "[compiler-rt] Also consider SIGPROF as a synchronous signal" (#86416)
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.
1 parent 5d7fd6a commit 4acd84e

File tree

6 files changed

+14
-16
lines changed

6 files changed

+14
-16
lines changed

compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ const int SIGFPE = 8;
126126
const int SIGSEGV = 11;
127127
const int SIGPIPE = 13;
128128
const int SIGTERM = 15;
129-
const int SIGPROF = 27;
130129
#if defined(__mips__) || SANITIZER_FREEBSD || SANITIZER_APPLE || SANITIZER_NETBSD
131130
const int SIGBUS = 10;
132131
const int SIGSYS = 12;
@@ -2180,8 +2179,7 @@ void sighandler(int sig, __sanitizer_siginfo *info, void *ctx) {
21802179
return;
21812180
}
21822181
// Don't mess with synchronous signals.
2183-
const bool sync = is_sync_signal(sctx, sig, info) ||
2184-
(sig == SIGPROF && thr->is_inited && !thr->is_dead);
2182+
const bool sync = is_sync_signal(sctx, sig, info);
21852183
if (sync ||
21862184
// If we are in blocking function, we can safely process it now
21872185
// (but check if we are in a recursive interceptor,

compiler-rt/test/tsan/signal_errno.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static void MyHandler(int, siginfo_t *s, void *c) {
1818

1919
static void* sendsignal(void *p) {
2020
barrier_wait(&barrier);
21-
pthread_kill(mainth, SIGALRM);
21+
pthread_kill(mainth, SIGPROF);
2222
return 0;
2323
}
2424

@@ -37,7 +37,7 @@ int main() {
3737
mainth = pthread_self();
3838
struct sigaction act = {};
3939
act.sa_sigaction = &MyHandler;
40-
sigaction(SIGALRM, &act, 0);
40+
sigaction(SIGPROF, &act, 0);
4141
pthread_t th;
4242
pthread_create(&th, 0, sendsignal, 0);
4343
loop();
@@ -46,7 +46,7 @@ int main() {
4646
}
4747

4848
// CHECK: WARNING: ThreadSanitizer: signal handler spoils errno
49-
// CHECK: Signal 14 handler invoked at:
49+
// CHECK: Signal 27 handler invoked at:
5050
// CHECK: #0 MyHandler(int, {{(__)?}}siginfo{{(_t)?}}*, void*) {{.*}}signal_errno.cpp
5151
// CHECK: main
5252
// CHECK: SUMMARY: ThreadSanitizer: signal handler spoils errno{{.*}}MyHandler

compiler-rt/test/tsan/signal_reset.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ static void* reset(void *p) {
2828
struct sigaction act = {};
2929
for (int i = 0; i < 1000000; i++) {
3030
act.sa_handler = &handler;
31-
if (sigaction(SIGALRM, &act, 0)) {
31+
if (sigaction(SIGPROF, &act, 0)) {
3232
perror("sigaction");
3333
exit(1);
3434
}
3535
act.sa_handler = SIG_IGN;
36-
if (sigaction(SIGALRM, &act, 0)) {
36+
if (sigaction(SIGPROF, &act, 0)) {
3737
perror("sigaction");
3838
exit(1);
3939
}
@@ -44,7 +44,7 @@ static void* reset(void *p) {
4444
int main() {
4545
struct sigaction act = {};
4646
act.sa_handler = SIG_IGN;
47-
if (sigaction(SIGALRM, &act, 0)) {
47+
if (sigaction(SIGPROF, &act, 0)) {
4848
perror("sigaction");
4949
exit(1);
5050
}
@@ -53,7 +53,7 @@ int main() {
5353
t.it_value.tv_sec = 0;
5454
t.it_value.tv_usec = 10;
5555
t.it_interval = t.it_value;
56-
if (setitimer(ITIMER_REAL, &t, 0)) {
56+
if (setitimer(ITIMER_PROF, &t, 0)) {
5757
perror("setitimer");
5858
exit(1);
5959
}

compiler-rt/test/tsan/signal_sync.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main() {
3030

3131
struct sigaction act = {};
3232
act.sa_handler = &handler;
33-
if (sigaction(SIGVTALRM, &act, 0)) {
33+
if (sigaction(SIGPROF, &act, 0)) {
3434
perror("sigaction");
3535
exit(1);
3636
}
@@ -39,7 +39,7 @@ int main() {
3939
t.it_value.tv_sec = 0;
4040
t.it_value.tv_usec = 10;
4141
t.it_interval = t.it_value;
42-
if (setitimer(ITIMER_VIRTUAL, &t, 0)) {
42+
if (setitimer(ITIMER_PROF, &t, 0)) {
4343
perror("setitimer");
4444
exit(1);
4545
}

compiler-rt/test/tsan/signal_thread.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static void* thr(void *p) {
2424
int main() {
2525
struct sigaction act = {};
2626
act.sa_handler = &handler;
27-
if (sigaction(SIGVTALRM, &act, 0)) {
27+
if (sigaction(SIGPROF, &act, 0)) {
2828
perror("sigaction");
2929
exit(1);
3030
}
@@ -33,7 +33,7 @@ int main() {
3333
t.it_value.tv_sec = 0;
3434
t.it_value.tv_usec = 10;
3535
t.it_interval = t.it_value;
36-
if (setitimer(ITIMER_VIRTUAL, &t, 0)) {
36+
if (setitimer(ITIMER_PROF, &t, 0)) {
3737
perror("setitimer");
3838
exit(1);
3939
}

compiler-rt/test/tsan/signal_thread2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static void *thr(void *p) {
4040
int main() {
4141
struct sigaction act = {};
4242
act.sa_handler = &handler;
43-
if (sigaction(SIGALRM, &act, 0)) {
43+
if (sigaction(SIGPROF, &act, 0)) {
4444
perror("sigaction");
4545
exit(1);
4646
}
@@ -49,7 +49,7 @@ int main() {
4949
t.it_value.tv_sec = 0;
5050
t.it_value.tv_usec = 10;
5151
t.it_interval = t.it_value;
52-
if (setitimer(ITIMER_REAL, &t, 0)) {
52+
if (setitimer(ITIMER_PROF, &t, 0)) {
5353
perror("setitimer");
5454
exit(1);
5555
}

0 commit comments

Comments
 (0)