Skip to content

sending a SIGSEGV via kill disables the stack overflow handler #140662

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

Open
joboet opened this issue May 5, 2025 · 0 comments
Open

sending a SIGSEGV via kill disables the stack overflow handler #140662

joboet opened this issue May 5, 2025 · 0 comments
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-bug Category: This is a bug. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@joboet
Copy link
Member

joboet commented May 5, 2025

SIGSEGV's are not exclusive to access violations, they can also be generated using raise or kill. Rust's stack overflow handler works by testing whether the address reported in the signal information is within the guard page range, and aborting the process along with a helpful message if so. If the address is outside of the guard page range, the handler uninstalls itself and returns with the intention of running faulty instructions again (which will lead to the default SIGSEGV behaviour occurring, e.g. a core dump on Linux). For SIGSEGVs not caused by access violations however, the process won't be aborted and execution will continue normally. Further stack overflows will however not cause the handler to be run.

A possible fix would be to re-raise the signal from the signal handler if it originates from a non-access-violation (by inspecting the si_code), but that would corrupt the information associated with the signal and might thus hinder debugging.

@joboet joboet added A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-bug Category: This is a bug. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 5, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 5, 2025
@joboet joboet removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-bug Category: This is a bug. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants