Skip to content

Fix race on fatal signals - #294

Draft
io-no wants to merge 20 commits into
mainfrom
fix-race-fatal-signals
Draft

Fix race on fatal signals#294
io-no wants to merge 20 commits into
mainfrom
fix-race-fatal-signals

Conversation

@io-no

@io-no io-no commented Dec 5, 2025

Copy link
Copy Markdown
Member

This PR proposes a fix for a race condition that appears when a process has multiple threads.
If we resume one thread and deliver a fatal signal (e.g., SIGSEGV), the kernel may start the thread-group exit before we resume the other threads. As a result, ptrace(PTRACE_CONT) on those threads fails because they have already begun exiting.

What this PR does

  • Detects when a signal is truly fatal to the process.
  • If a fatal signal is pending, only the affected thread is resumed.
  • Other threads remain stopped, avoiding the race and preventing PTRACE_CONT failures.

Status

Draft for two reasons:

  • The approach works in initial testing but needs broader validation.
  • It builds on Add exec/execv/execve support #273, which is also a draft (we can cherry-pick if needed).
  • I'm not totally convinced of some details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants