rust-lang / rust-lang/rust

sending a SIGSEGV via `kill` disables the stack overflow handler

Open
#140,662 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-runtime C-bug T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by tracing Rust's stack overflow signal handler and how it distinguishes access violations from SIGSEGV sent by raise or kill, then determine behavior that preserves signal information while keeping later stack overflows handled. Done means externally generated SIGSEGVs no longer disable the stack overflow handler.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.