Skip to content

libobs: Preserve process-pipe wait errors - #501

Merged
zackees merged 2 commits into
obs-rust:masterfrom
ProtonDev-sys:fix/pipe-wait-error
Oct 13, 2026
Merged

zackees merged 2 commits into
obs-rust:masterfrom
ProtonDev-sys:fix/pipe-wait-error

Conversation

@ProtonDev-sys

Copy link
Copy Markdown
Contributor

Refs #500

What and why

Preserve permanent waitpid failures from os_process_pipe_destroy. Previously, after a failed wait, WIFEXITED(status) read an uninitialized status slot and could overwrite -1 with an apparent successful exit code. Decode the status only when the wait succeeded. Keep normal exits, signal exits, and the existing EINTR retry unchanged.

Add a Linux regression around the real pipe-posix.c. With SIGCHLD=SIG_IGN, the kernel auto-reaps the child and produces ECHILD; the wait wrapper seeds the status slot to make the invalid read deterministic. Normal exit and one EINTR retry are controls.

RED → GREEN

  • RED commit: 0831d51e4af6bbe24a06e282a60be8407d1f01ce. The branch author reports the auto-reaped-child case returns 0 instead of -1; normal-exit and EINTR controls pass. An unwrapped Linux probe using automatic-variable zero initialization also fails on the original source.
  • GREEN commit: 6266a29a0f4d6d2a54439303d208194ec50eaf28. The branch author reports all three cases pass with GCC and Clang, including 100 ASan/UBSan/LSan runs. Reverting the condition restores the failure; the unwrapped SIGCHLD=SIG_IGN probe returns -1 with the fix.
  • The submitting agent inspected the commits and diff but has not independently rerun these tests.

Remaining validation

Draft: the branch author states the full OBS gate and other platforms were not tested. The required local-gate attestation is not present in the pushed head. Full repository integration, lint, and the required test lanes remain unverified.

Checklist

  • Base is master
  • I claimed the issue, or no one else has an open PR for it
  • RED, then GREEN commits
  • Local gate passed and the pushed head is stamped
  • Intentional differences from C listed in the parity test header and rust/README.md (not applicable: this is a C bug fix, not a Rust port)

AI assistance: branch commits credit gpt-6-astra-pro; Codex inspected and submitted the existing branch on the account owner's request. The related bug report was filed before this PR because upstream issue creation was blocked for the fork author by connector permissions.

With SIGCHLD ignored, the real waitpid fails with ECHILD. Seed its status
slot to expose the invalid read deterministically: destroy returns 0
instead of -1. Normal exit and EINTR-retry controls pass.

The original source also fails an unwrapped Linux probe when compiled
with automatic-variable zero initialization. Upstream issue filing was
blocked by integration permissions; fork issues are disabled.

AI assistance: gpt-6-astra-pro.
Only decode the child status after a successful waitpid. Otherwise the
uninitialized status can overwrite -1 with an arbitrary exit code.
Normal exits, signal exits and the existing EINTR retry are unchanged.

All three Linux regression cases pass with GCC and Clang, including
100 ASan/UBSan/LSan runs. Reverting the condition restores the failure.
An unwrapped SIGCHLD=SIG_IGN probe also returns -1 with the fix.
The full OBS gate and other platforms were not tested.

AI assistance: gpt-6-astra-pro.
@zackees
zackees marked this pull request as ready for review October 13, 2026 19:56
@zackees
zackees self-requested a review as a code owner October 13, 2026 19:56
@zackees
zackees merged commit 1be6c8f into obs-rust:master Oct 13, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants