Hello,
I'm investigating the supported macOS mechanisms for supervising a single unprivileged, sandboxed worker process.
The target environment is macOS 15.6 (24G84), Apple Silicon (arm64).
The worker is intended to operate under a separate Standard user identity, with tightly restricted capabilities and no requirement to create child processes.
The main challenge is the startup failure window:
A controller initiates worker creation, but exits unexpectedly before spawn returns or before the worker's identity and authenticated handshake can be independently recorded.
In this situation, we need a supported approach to prevent the worker from becoming an unaccounted-for process, or to recover sufficiently trustworthy custody to determine its lifecycle and cleanup state.
I have reviewed direct child-process supervision, POSIX process groups, launchd job behaviour, sandbox inheritance, resource limits and process identification mechanisms.
I would appreciate guidance on the following:
- Is there a public, supported macOS API or system service that provides recoverable process custody from initial worker creation, including controller failure during startup?
- Could an application-associated XPC service or launchd mechanism provide the required lifecycle relationship without granting the worker independent ongoing execution authority?
- Is generation-safe, audit-token-based process signaling available through a supported public interface, and what are its privilege and acquisition requirements?
- Is setting a hard RLIMIT_NPROC limit before worker operations a supported way to prevent further fork/spawn activity by an unprivileged worker? What limitations or exceptions should be considered?
- What can macOS guarantee about process termination and cleanup after controller failure, and what must remain application-level verification?
I'm particularly interested in documented guarantees and supported APIs rather than behaviour observed only in tests or private interfaces.
Any recommendations or references to Apple documentation would be greatly appreciated.
Thank you.