Skip to content

Move Unix domain sockets into the broker - #1493

Open
Weidong Cui (wdcui) wants to merge 2 commits into
uliteboxfrom
wdcui/ulitebox/local-sockets
Open

Weidong Cui (wdcui) wants to merge 2 commits into
uliteboxfrom
wdcui/ulitebox/local-sockets

Conversation

@wdcui

@wdcui Weidong Cui (wdcui) commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

This PR moves Unix domain sockets from the runner-local shim implementation into the broker as guest-neutral local sockets, so they can be shared across processes and inherited across fork and exec, which previously refused Unix socket fds. It adds the local socket protocol and wire codec, a broker-core socket table (path names bound as files in the broker filesystem with write-permission checks on connect, abstract names keyed per socket type, listen backlogs, stream and datagram queues charged against per-process and global byte quotas including unaccepted connections, shutdown, readiness, timeouts, and shared status flags), host dispatch and handle duplication, the BrokerLocal client, and a LocalSocket facade in litebox. The Linux shim's Unix socket support is rewritten as a thin wrapper over that facade (removing channel.rs and the shim address table), Unix socket fds are inherited across fork and exec, read/readv/writev on Unix datagram sockets now preserve datagram boundaries, Unix socket addresses returned to the guest are truncated to the caller's buffer like Linux (an addrlen below 2 previously underflowed), and an EPIPE on a Unix datagram socket no longer raises SIGPIPE. Broker-core and shim unit tests cover the new semantics, and a new runner test checks that forked and exec'd children share stream, datagram, and path-bound listening sockets with their parent.

Weidong Cui (wdcui) and others added 2 commits October 3, 2026 18:29
Unix domain sockets become guest-neutral broker-owned local sockets, so
they can be shared across processes and inherited across fork and exec.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ceea8bb3-229a-4415-a471-bb3b41d4fed0
Copy Unix socket addresses truncated to the caller's buffer like Linux,
which previously underflowed when addrlen was below 2, and raise SIGPIPE
only for Unix stream sockets.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ceea8bb3-229a-4415-a471-bb3b41d4fed0
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

🤖 SemverChecks 🤖 ⚠️ Potential breaking API changes detected ⚠️

Click for details
--- failure auto_trait_impl_removed: auto trait no longer implemented ---

Description:
A public type has stopped implementing one or more auto traits. This can break downstream code that depends on the traits being implemented.
        ref: https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/auto_trait_impl_removed.ron

Failed in:
  type InheritableFd is no longer UnwindSafe, in /home/runner/work/litebox/litebox/litebox/src/process.rs:114
  type InheritableFd is no longer RefUnwindSafe, in /home/runner/work/litebox/litebox/litebox/src/process.rs:114

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/enum_variant_added.ron

Failed in:
  variant InheritableFd:LocalSocket in /home/runner/work/litebox/litebox/litebox/src/process.rs:120

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/enum_variant_added.ron

Failed in:
  variant BrokerOperation:LocalSocket in /home/runner/work/litebox/litebox/litebox_broker_protocol/src/message.rs:113
  variant BrokerResult:LocalSocket in /home/runner/work/litebox/litebox/litebox_broker_protocol/src/message.rs:406

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/enum_variant_added.ron

Failed in:
  variant InheritedFdKind:LocalSocket in /home/runner/work/litebox/litebox/litebox_common_linux/src/program_startup.rs:120

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