Skip to content

exec: preserve signals across command fork - #572

Open
sairex53 wants to merge 1 commit into
sudo-project:mainfrom
sairex53:fix-566-signal-forwarding
Open

sairex53 wants to merge 1 commit into
sudo-project:mainfrom
sairex53:fix-566-signal-forwarding

Conversation

@sairex53

Copy link
Copy Markdown

Fixes the fork-to-exec signal race reported in #566. Signals remain blocked across the command fork; the child restores the saved signal dispositions before restoring its signal mask, so a forwarded signal stays pending until the command can receive it. This also preserves signals that were ignored by sudo\x27s caller.

Thanks to @pepa-cz for the detailed analysis and reproducer in #566; this implements the approach described there.

Validation on Fedora 44 aarch64 (kernel 7.2.6), building in an Ubuntu 24.04 arm64 container:

  • make check passes.
  • The issue reproducer terminated the command in 50/50 runs with and without use_pty (0 lost SIGTERMs).
  • Verified an ignored SIGTERM remains ignored by the executed command.

Signed-off-by: Eduard Zateev <hackerowskiy@gmail.com>
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.

1 participant