rust-lang / rust-lang/rust

Incorrect use of `sigaction` in Unix stack overflow signal handler

Open
#159,929 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug needs-triage
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Currently the Unix stack overflow signal handler sets the sa_sigaction field to SIG_DFL in order to restore the default behavior. This however only works unintentionally.

According to the sigaction manpage the intended field to set for this purpose is sa_handler, which may or may not be an union with sa_sigaction. This issue is currently not actionable because of libc#3111, but documents the problem.

The theoretical correct code, once libc adds the sa_handler field, would be

action.sa_handler = SIG_DFL;

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

Start with library/std/src/sys/pal/unix/stack_overflow.rs at the linked signal-handler code, then review libc#3111 for the missing sa_handler field. Once libc exposes that field, update the restoration logic and verify the Unix stack-overflow signal-handler behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.