Linux sandbox: support safe sandbox-local AF_UNIX sockets (e.g., sccache)
Open 💬 2 comments Opened Apr 6, 2026 by rebroad
Summary
Please consider supporting safe sandbox-local socket IPC so tools like sccache can work under Linux sandboxing.
Today, strict sandboxing blocks socket operations, which prevents sccache from functioning as RUSTC_WRAPPER.
Goal
Enable local IPC needed by developer tools without reintroducing broad host/network exposure.
Proposed safe model
- Keep
--unshare-netenabled (no external network namespace sharing). - Allow AF_UNIX socket creation/connection for sandboxed processes.
- Deny AF_INET/AF_INET6 socket creation in this mode.
- Use private sandbox temp/runtime dirs (for example private
/tmptmpfs) so UNIX sockets are sandbox-local, not host-shared.
This allows local daemon-style tools (sccache) to work while keeping network and host-socket exposure constrained.
Why this is useful
sccacheclient/server uses local sockets for wrapper↔daemon communication.- In locked-down sandboxes, builds currently require disabling
RUSTC_WRAPPER, losing cache speedups. - A sandbox-local UDS model preserves performance benefits with tighter boundaries.
Concrete example
A supported pattern could be:
SCCACHE_SERVER_UDS=/tmp/sccache/sccache.sockSCCACHE_DIR=/tmp/sccache/cache
when /tmp is private to the sandbox.
Clarification request
If there is already a recommended configuration for sandbox-local AF_UNIX IPC that works with sccache, please document it.
2 Comments
Same issue, can't use
sccacheinside the sandbox, even when adding the cache directory as a writeable root.I shared my log through
/feedback:thread ID 019d8e32-b97c-7da1-ad24-6126b874a132I was annoyed by this problem too so I took the liberty to implement a file based IPC layer for sccache: https://github.com/marmeladema/sccache/tree/feature/fifo-ipc
In order to use it you need to manually start the server outside of the sandbox like the following:
Then configure codex to allow sccache cache directory as writable:
Note that Landlock added support for pathname-based socket connection rules with
LANDLOCK_ACCESS_FS_RESOLVE_UNIXin ABI 9 which I believe has been shipped as part of Linux kernel 7.1.x series so it's only a matter of time before it trickles down to codex itself.