On this page

0215. Working macOS Seatbelt profile, toolchain roots and exec helper

Context

The workspace-rooted profile aborted even echo on macOS 26.6.2. Crash reports showed dyld aborting during shared-cache discovery, with Seatbelt denying read data on /. An otherwise identical profile granting that literal directory started echo, sh, and Python. ADR-0097 shipped untested. Linux snapshots cannot establish Mac enforcement.

Decision

  1. Keep deny-default Seatbelt and explicit system read/map roots, excluding /System/Volumes/Data with require-not to prevent firmlink reads. Grant metadata for proper ancestors and read data for the literal / directory so dyld can locate its shared cache. Keep narrow dyld/timezone/shell-selection reads, null/random/zero/dtracehelper device operations, read-only sysctl and signals confined to the same sandbox. Workspace reads include executable mapping. No broad HOME, tmp, mach-lookup or shared-memory grant.
  2. Canonicalize roots before spawning. On macOS only, workspace-rooted children start in that root and writable ones get TMPDIR=<root>/. Root / keeps cwd and environment unchanged. PATH remains /usr/bin:/bin on both hosts.
  3. [policy] sandbox_toolchains is a closed set: xcode-select default, homebrew opt-in, [] off; invalid/duplicate names produce E0845. Canonicalize the selected developer link, promoting .app/Contents/Developer to its bundle. Missing selection falls back to system-readable CLT. Reject volume roots and workspace ancestors. Resolve only listed Homebrew tool directories, never /opt/homebrew/var; ignore parent DEVELOPER_DIR.
  4. Mac escape/startup proofs must pass before printing sandbox: enforced seatbelt. Accept EPERM or EACCES denials. M14.3 remains open through review and merge. Darwin process-plugin launch now uses the private snapshot path in ADR-0229;18 focused process-plugin tests and the actual TUI highlighter pass on both backends on this Mac. Linux descriptor execution remains unqualified by this Mac run.
  5. W7: under an app-scope lease, limited macOS interpreter runs join its PGID through the prepared launcher's --exec mode. Command starts only our compiled Mach-O helper, never a user program. The helper uses execve and explicit PATH search, preserving argv[0] and returning ENOEXEC=8 without shell fallback (ADR-0087). No-lease runs keep subprocess. The helper is prepared once per program; this scoped path requires a C compiler and has serial error-file IO.
  6. Bounded macOS interpreter runs use socket pairs for the pump's standard streams. The direct-exec launcher accepts the child endpoints as files. For process limits on both backends, a Darwin group-signal EPERM is considered complete only after retained identities and a full group snapshot prove the group has no live members. An unleased group retains its direct child leader; an authenticated borrowed lease additionally requires its separately retained broker witness (ADR0228). Signal the group and direct child before reaping. Preserve permission errors whenever proof is absent.
  7. On macOS, the tool registry checks that the configured absolute command names an executable regular file before launching through sandbox-exec. The launch handshake otherwise confirms the wrapper before it tries the command. The registry handles subsequent child exits through its normal lifecycle checks.
  8. Locked Darwin process plugins execute a private, verified snapshot under Seatbelt rather than the original package path. fs = "none" grants only the exact snapshot executable; the source package root is used for containment validation, not as a read grant. Optional toolchain subpaths are omitted from this profile. See ADR-0229 for the deadline, cleanup and relocation limits; focused Mac verification remains separate evidence.

Alternatives considered

Consequences

Read-only sandboxes cannot compile files. DNS with network enabled may need a narrow dnssd mach lookup; it remains unverified. sandbox-exec itself uses execvp: inside sandboxes, ENOEXEC may invoke a shell and missing commands exit 71. Those gaps stay in the parking lot. Linux policy, environment, cwd, existing goldens and default emitted-C digests stay unchanged. Mac verification and the required Sonnet review remain separate acceptance evidence, not Linux claims.