Skip to content

Commit

Permalink
fix: handle SIGBUS when looking for stack overflows (#4971)
Browse files Browse the repository at this point in the history
Without this change, a stack overflow on Mac OS during tactic execution
can lead to the message:

    terminated by signal SIGBUS (Misaligned address error)

This comes from `lean_alloc_small`. With the change, the process instead
terminates with the more accurate and actionable:

    Stack overflow detected. Aborting.
  • Loading branch information
david-christiansen authored Aug 12, 2024
1 parent 12ca422 commit ecd3aa4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/runtime/stack_overflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ void initialize_stack_overflow() {
action.sa_flags = SA_SIGINFO | SA_ONSTACK;
action.sa_sigaction = segv_handler;
sigaction(SIGSEGV, &action, nullptr);
sigaction(SIGBUS, &action, nullptr);
#endif
}

Expand Down

0 comments on commit ecd3aa4

Please sign in to comment.