Skip to content
Snippets Groups Projects
Commit 9fad49e0 authored by Ben Gamari's avatar Ben Gamari Committed by Marge Bot
Browse files

rts: Do not call exit() from SIGINT handler

Previously `shutdown_handler` would call `stg_exit` if the scheduler was
Oalready found to be in `SCHED_INTERRUPTING` state (or higher). However,
`stg_exit` is not signal-safe as it calls `exit` (which calls `atexit`
handlers). The only safe thing to do in this situation is to call
`_exit`, which terminates with minimal cleanup.

Fixes #23417.
parent 3e80c2b4
No related branches found
No related tags found
No related merge requests found
......@@ -522,7 +522,9 @@ shutdown_handler(int sig STG_UNUSED)
// extreme prejudice. So the first ^C tries to exit the program
// cleanly, and the second one just kills it.
if (getSchedState() >= SCHED_INTERRUPTING) {
stg_exit(EXIT_INTERRUPTED);
// N.B. we cannot use stg_exit() here as it calls exit() which is not
// signal-safe. See #23417.
_exit(EXIT_INTERRUPTED);
} else {
interruptStgRts();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment