Make SIGILL fatal instead of looping in its signal handler - #1926
Open
willbuckner wants to merge 1 commit into
Open
Make SIGILL fatal instead of looping in its signal handler#1926willbuckner wants to merge 1 commit into
willbuckner wants to merge 1 commit into
Conversation
Found by: michaelortmann Fixes: eggheads#1640 got_ill() logged the signal and returned. Returning from a SIGILL handler re-executes the faulting instruction, so a real illegal instruction re-raised the signal immediately, spamming the log in an endless loop, and no core dump or stack trace was ever produced. Treat SIGILL like SIGBUS/SIGSEGV: write the DEBUG file, log the crash and re-raise the signal with its default action restored so the bot dies with a core dump. Restore the default action explicitly instead of relying on SA_RESETHAND alone: at least on macOS the handler stays installed when the signal is re-raised from within the handler, which would turn the re-raise into another endless loop. This removes the (now pointless) sigill Tcl evnt bind; the bot no longer survives SIGILL.
Member
|
ok, I'll bite... Wcc? |
Author
|
yes :P |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by: michaelortmann
Patch by: willbuckner
Fixes: #1640
One-line summary: Make SIGILL fatal instead of looping in its signal handler
Additional description (if needed):
got_ill() logged the signal and returned. Returning from a SIGILL handler re-executes the faulting instruction, so a real illegal instruction re-raised the signal immediately, spamming the log in an endless loop, and no core dump or stack trace was ever produced.
Treat SIGILL like SIGBUS/SIGSEGV: write the DEBUG file, log the crash and re-raise the signal with its default action restored so the bot dies with a core dump.
Restore the default action explicitly instead of relying on SA_RESETHAND alone: at least on macOS the handler stays installed when the signal is re-raised from within the handler, which would turn the re-raise into another endless loop.
This removes the (now pointless) sigill Tcl evnt bind; the bot no longer survives SIGILL.
Test cases demonstrating functionality (if applicable): N/A