0229: Execute locked process plugins from private Darwin snapshots
- Status: Accepted; focused Mac qualification is tracked separately
- Date: 2026-11-12
- Amends: ADR-0099 and ADR-0215
Context
Darwin does not support the descriptor execution used by Linux
for locked process plugins. Reopening the original command path
after verifying its hash would reintroduce a replacement race. A
launch path also needs to preserve the plugin filesystem ceiling:
fs = "none" must not become a grant to the package or
to / merely to make the executable launchable.
Decision
For a locked Darwin plugin, open the source executable once,
validate the opened file's resolved path under a canonical
package-source root, and copy from that descriptor into a private
temporary directory. The package-source root is a validation-only
witness; it grants no filesystem access. When
fs = "package", its separate package read root must
match that witness and is granted read-only. When
fs = "none", the read root is empty and the Seatbelt
profile emits no package-root subpath. It grants only the staged
executable as a literal file for read and executable mapping, with
metadata access to its ancestor directories. The temporary
directory is private (0700); the staged image is made
read-only, re-opened without following symlinks, checked as a
regular file of the expected size, and hashed against the lock
before launch. Optional Xcode and Homebrew toolchain subpaths are
omitted from this profile so they cannot widen the literal-file
boundary.
The original package path is never executed for locked Darwin plugins. One absolute deadline begins before snapshot work and covers descriptor validation, copying, hashing, broker lease, sandbox startup, and child execution. The parent closes descriptors and removes the image and temporary directory on success and failure, including late child replies after bounded group cleanup.
An explicit --dev bare PATH command remains
unhashed and is launched directly under its sandbox policy; it
does not receive the locked snapshot guarantee. Linux continues to
hash and execute the verified descriptor with
fexecve.
Limits and security boundary
The snapshot basename matches the source executable basename,
but argv[0] contains the staged snapshot path. Mach-O
@executable_path and @loader_path
references may therefore resolve differently after relocation.
Supported packaged Mach-O images are scoped to standalone or
system-linked executables; package-relative dylib bundles are not
established by this design. Some relocated Apple platform images
may be rejected by macOS. The private snapshot protects against
pathname replacement, not a hostile process with the same trusted
host identity. The process-group proof uses
proc_pidinfo after fork; that call is not specified
as POSIX async-signal-safe.
Linux retains its existing descriptor execution path. This
decision does not qualify its /proc source-path
checks or close_range failure cases, which remain
unverified.
Verification status
The focused macOS process-plugin suite passes18/18 tests, including snapshot replacement/mutation, empty-root filesystem and network denial, inherited descriptors, broker reuse, and bounded startup/cleanup. The plugin-limit test and actual TUI highlighter also pass on C and interpreter backends. See plans/tui/VALIDATION.md for final candidate and gate evidence. This focused qualification is separate from the general rooted Seatbelt escape gate; that gate alone does not prove these plugin properties.