Skip to content

Close the child copy of the read end in stdout capture spawning #559

Closed

Description

@LunaStev

proc_spawn_capture_stdout creates a pipe and passes only its write end to proc_spawn_exec_raw. After fork, the child inherits both ends, but its setup has no knowledge of the unused read end and does not close it before exec. If the parent closes its capture read fd, the child still holds a reader; writing can fill the pipe and block instead of observing that the consumer has gone away. The unused fd is also leaked into the executed program.

Code evidence:

Acceptance:

  • Close unused capture pipe ends in the appropriate process before exec, or use a correct close-on-exec ownership strategy.
  • Test the child descriptor inventory and early closure of the parent read end without leaving a blocked child.
  • Cover fork/exec setup failures and repeated capture operations for fd leaks.
  • Preserve the intended inherited stdout and keep this fix separate from general remapping of shared/cyclic descriptors.

Audit status: static source inspection against canonical master ea74c2dafc31da876e5561f2d176ba719f5a0458 on 2026-09-10. No compiler build, test execution, implementation change or local reproduction was performed for this report. The examples describe the source-derived behavior to verify when implementing the fix.

Activity

  1. added
    bug
    help wanted
    on Sep 10, 2026
  2. added a commit that references this issue on Sep 16, 2026
    451cc7a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions