Skip to content
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

DAOS-14248 engine: strengthen signals handling #13031

Merged
merged 5 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/engine/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,7 @@ main(int argc, char **argv)
sigdelset(&set, SIGFPE);
sigdelset(&set, SIGBUS);
sigdelset(&set, SIGSEGV);
sigdelset(&set, SIGTRAP);
/** also allow abort()/assert() to trigger */
sigdelset(&set, SIGABRT);

Expand Down Expand Up @@ -1281,6 +1282,8 @@ main(int argc, char **argv)
if (sig == SIGUSR1) {
D_INFO("got SIGUSR1, dumping Argobots infos and ULTs stacks\n");
dss_dump_ABT_state(abt_infos);
/* re-add SIGUSR1 to set */
sigaddset(&set, SIGUSR1);
continue;
}

Expand All @@ -1292,6 +1295,8 @@ main(int argc, char **argv)
ABT_info_trigger_print_all_thread_stacks(abt_infos,
10.0, NULL,
NULL);
/* re-add SIGUSR2 to set */
sigaddset(&set, SIGUSR2);
continue;
}

Expand Down
23 changes: 11 additions & 12 deletions src/gurt/signals.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,14 @@ print_backtrace(int signo, siginfo_t *info, void *p)
PRINT_ERROR("No useful backtrace available");
}

/* re-register old handler */
/* re-register old handler
*
* XXX we may choose to forget about old handler and simply register
* signal again as SIG_DFL and raise it for corefile creation
*
* XXX will old handler get accurate/original siginfo_t/ucontext_t ?
* should we instead call it with the same params we got ?
*/
rc = sigaction(signo, &old_handlers[signo], NULL);
if (rc != 0) {
D_ERROR("sigaction() failure registering new and reading old %d signal handler",
Expand All @@ -102,17 +109,8 @@ print_backtrace(int signo, siginfo_t *info, void *p)
exit(EXIT_FAILURE);
}

/* XXX we may choose to forget about old handler and simply register
* signal again as SIG_DFL and raise it for corefile creation
*/
if (old_handlers[signo].sa_sigaction != NULL || old_handlers[signo].sa_handler != SIG_IGN) {
/* XXX will old handler get accurate siginfo_t/ucontext_t ?
* we may prefer to call it with the same params we got ?
*/
raise(signo);
}

memset(&old_handlers[signo], 0, sizeof(struct sigaction));
/* raise signal again for either old handler or system default action */
raise(signo);
}

static bool register_handler = false;
Expand Down Expand Up @@ -142,6 +140,7 @@ d_signal_register()
daos_register_sighand(SIGBUS, print_backtrace);
daos_register_sighand(SIGSEGV, print_backtrace);
daos_register_sighand(SIGABRT, print_backtrace);
daos_register_sighand(SIGTRAP, print_backtrace);

registered = true;
}
Loading