Revert "[compiler-rt] Also consider SIGPROF as a synchronous signal" (#86416)

Reverting #85188 with follow up patches.

This reverts commit 362d26366d0175f01ffb6085eb747a6e40f01147.
This reverts commit c9bdeabdf4b46fbf1f6a9fcbf9cd61d460b18c08.
This reverts commit 6bc6e1ace9fa8453e164fa04b5d9acd5a77e089a.
This reverts commit 01fa550ff654d6724e6da54c877032baeddff14b.
This reverts commit ddcbab37ac0e5743a8d39be3dd48d967f4c85504.
This commit is contained in:
Vitaly Buka 2024-03-24 01:22:48 -07:00 committed by GitHub
parent 5d7fd6a04a
commit 4acd84e7cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 14 additions and 16 deletions

View File

@ -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,

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}