Skip to content

Add support for runc's --pidfd-socket - #115

Merged
mxpv merged 1 commit into
containerd:mainfrom
cpuguy83:pidfd-socket
Aug 21, 2026
Merged

Add support for runc's --pidfd-socket#115
mxpv merged 1 commit into
containerd:mainfrom
cpuguy83:pidfd-socket

Conversation

@cpuguy83

Copy link
Copy Markdown
Member

runc can send a pidfd for the process it creates over a unix socket. A
pidfd lets the caller signal or wait on that process without racing
against the pid reuse that a pid from --pid-file is subject to.

Adds PidfdSocket to CreateOpts and ExecOpts, covering create, run and
exec, plus the socket constructors and ReceivePidfd to accept the
descriptor. runc restore has no such flag, so RestoreOpts is unchanged.

The socket plumbing shared with the console socket moves to socket.go,
leaving console.go with only the console-specific parts.

Additionally adds a minor hardening to not leak fd's when receiving them in error cases.

runc can send a pidfd for the process it creates over a unix socket. A
pidfd lets the caller signal or wait on that process without racing
against the pid reuse that a pid from --pid-file is subject to.

Adds PidfdSocket to CreateOpts and ExecOpts, covering create, run and
exec, plus the socket constructors and ReceivePidfd to accept the
descriptor. runc restore has no such flag, so RestoreOpts is unchanged.

The socket plumbing shared with the console socket moves to socket.go,
leaving console.go with only the console-specific parts.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@fuweid

fuweid commented Jul 30, 2026

Copy link
Copy Markdown
Member

Thanks for working on this! - containerd/containerd#9175

@fuweid fuweid self-assigned this Jul 30, 2026
Comment thread socket.go Outdated
@mxpv
mxpv merged commit cbab5b2 into containerd:main Aug 21, 2026
4 checks passed
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.

3 participants