8000 fix(minvmd): replace raw-PID gvproxy signalling with pidfd by gominimal-aw-bot[bot] · Pull Request #555 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minvmd): replace raw-PID gvproxy signalling with pidfd - #555

Merged
norrietaylor merged 2 commits into
mainfrom
sdd/550-gvproxy-pidfd-3343ddf2bf060369
Jun 24, 2026
Merged

norrietaylor merged 2 commits into
mainfrom
sdd/550-gvproxy-pidfd-3343ddf2bf060369

Conversation

@gominimal-aw-bot
@gominimal-aw-bot gominimal-aw-bot Bot commented Jun 24, 2026 •
Copy link
Copy Markdown
Contributor

[sdd-fastpath: tracking=550 tier=sonnet]

Fixes the independent-crash recycled-PID window in GvproxySwitch (#550).

What changed

Replaces raw-PID kill(2) on all three teardown paths with pidfd_send_signal(2) via libc::syscall(SYS_pidfd_send_signal, ...):

  • GvproxySwitch::stop()
  • GvproxySwitch::Drop
  • PtaskAttachment::Drop

pidfd_open(2) is called immediately after the child PID is extracted in supervise(), before the supervision task is spawned. The Arc<OwnedFd> is shared with every PtaskAttachment so all teardown paths use the same pidfd. A pidfd is bound to the exact process instance — pidfd_send_signal returns ESRCH after the process exits, never resolving to a recycled PID.

signal_child (raw kill(2)) is retained under #[cfg(not(target_os = "linux"))] for macOS development builds.

Proof artifacts

Test — cargo test -p minvmd net::tests::pidfd_signal_to_reaped_child_returns_esrch:

test net::tests::pidfd_signal_to_reaped_child_returns_esrch ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 71 filtered out; finished in 0.00s

File — grep -q 'pidfd' crates/minvmd/src/net.rs:
Returns exit code 0 (pidfd is present in net.rs).

All 19 net tests (including existing teardown tests):

test net::tests::drop_sigkills_supervised_child_without_blocking ... ok
test net::tests::last_ptask_detach_terminates_switch ... ok
test net::tests::pidfd_signal_to_reaped_child_returns_esrch ... ok
test net::tests::stop_terminates_supervised_child ... ok
test net::tests::unexpected_exit_fires_notify ... ok
test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 53 filtered out; finished in 0.02s

Merging this pull request advances the tracking issue from sdd:in-progress to sdd:done; a human does the final close.

Generated by sdd-execute (sonnet tier) · ◷

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved Linux process supervision and teardown reliability by using safer, recycle-resistant signaling to ensure supervised services terminate and clean up correctly.
  • Tests

    • Added Linux-only coverage to confirm correct pidfd signaling behavior, including expected failure after a process has been reaped.

Loading
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

0