sandlock icon indicating copy to clipboard operation
sandlock copied to clipboard

control: process-wide switch to disable the control socket and name registry

Open congwang-mk opened this issue 1 month ago • 0 comments

Embedders that do not use introspection still get a SysV name claim and an abstract control socket per sandbox. A per-sandbox opt-out is the wrong scope (see 9c1981b0): registration is the host program's concern, the same answer for every sandbox it runs.

Design:

  • `sandlock_core::registry::disable()`, called once at startup before any spawn, backed by an `AtomicBool` checked in `do_spawn`. One-line FFI, Python and Go wrappers. Default stays on, so the CLI and SDK users remain visible to `sandlock ps`.
  • Disabled: no semaphore claim, no abstract socket, no control loop. `.name()` still sets the virtual hostname; `Controller` and pidfd-based control are unaffected.
  • Name uniqueness: disabling is explicit and process-wide, so the host owns naming. Document that names are no longer UID-wide mutexes.
  • The best-effort fallback for a failed bind (EPERM/EACCES/ENOSYS, nested sandboxes) stays.

Rejected: an env var (inherited by sandboxed children, so nested sandlock silently unregisters) and registering only explicitly named sandboxes (couples hostname with visibility; auto-named runs vanish from `ps`).

congwang-mk avatar Oct 23 '26 05:10 congwang-mk