You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cmd::exec can close an unrelated descriptor after stdin is consumed #2159
Cmd::exec closes the nonempty stdin pipe after all bytes are sent, but leaves that descriptor number in stdinPipe[1]. The scope cleanup closes the same number again after the child exits. If another thread opens a file in this interval, Linux can reuse that number and the cleanup closes the unrelated new descriptor.
The production path ContainerCfgBuilder::applyExecutablePatch uses Cmd(patchFile).toStdin(OCI config JSON).exec(). This report concerns successful consumption of stdin, independent of the SIGPIPE problem tracked in #1931/#1926.
A real-process regression uses Cmd -> /bin/sh -> /bin/cat. The child consumes stdin to EOF and signals readiness; a second thread opens 16 /dev/null descriptors, then releases the child to exit. After the successful command returns, fcntl(F_GETFD) finds one of those descriptors closed:
Related open changes were inspected by their actual head diffs: #1926 handles SIGPIPE; #2068 validates executable commands; #2122 fixes PipeSet parent/child ends. None clears this completed-input descriptor.
AI assistance: prepared with OpenAI Codex. Reproduction uses real Linux child processes, pipes, threads, open, close and fcntl calls. Complete validation results will be documented in the linked fix PR; no full container/deployment validation is claimed.
This PR contains the minimal stdin descriptor ownership fix and the real-process regression test. Validation and AI disclosure are in the PR description.
Activity
iloveeyjafjalla commentedon Oct 10, 2026
Fix PR: #2160
This PR contains the minimal stdin descriptor ownership fix and the real-process regression test. Validation and AI disclosure are in the PR description.