Expand description
Starting the first tracee and wiring supervisor, listener and tracer.
The child installs the seccomp filter and hands the listener back over a
socketpair, then waits for one byte. The parent seizes it with ptrace,
starts the notification pool and sends the byte, so the child’s first
traced syscall already has a tracer and no SIGSTOP handshake is needed.
Where the ptrace syscall is filtered out (a hardened container profile),
or when PROOT_NO_PTRACE is set, there is no tracer: the filter sends the
trace tier to the listener as well, the child’s kernel working directory
is pinned to the alias directory holding the exec shim, and the handlers
in syscall::direct do the rest. The process table is then lazy and a
reaper thread watches pidfds for exits.
Where the kernel’s ptrace access check refuses the supervisor even
towards its own child (Yama’s ptrace_scope of 2), the first tracee
enters a user namespace of its own before installing the filter; see
access. Where that is refused too, the guest-stub restricted mode
(see guest_stub) traps the served syscalls into a stub inside each
guest, and the first tracee execs the trampoline that arms it, with a
plan the supervisor wrote before letting it go.
Statics§
- environ 🔒 ⚠
Traits§
- From
Bytes 🔒Hack - Byte-slice to
OsStrhelper kept local to avoid a trait import at call sites.
Functions§
- become_
subreaper 🔒 - Makes the supervisor the parent of every orphan among its descendants.
- exit_
like_ 🔒bwrap_ without_ namespaces - Exits the way bubblewrap exits when it cannot create its namespaces.
- guest_
stub_ 🔒choice - When the guest-stub restricted mode may be used, from
PROOT_GUEST_STUB: as the fallback where nothing else reaches the guest’s memory (unset, or any other value), anywhere (force), or never (0). - no_
ptrace_ 🔒forced - Whether
PROOT_NO_PTRACEforces the mode without a ptrace tier (any value but0). - plan_
first_ 🔒trapped - Plans the first tracee’s exec in the guest-stub restricted mode: its command, argument vector and environment as the child will exec them.
- recv_fd 🔒
- Receives a descriptor sent by
send_fd. - report_
status 🔒 - Writes one status line to each of bubblewrap’s
--info-fd/--json-status-fddescriptors. - resolve_
command_ 🔒in_ path - Resolves a bare command name through
PATH, as seen from inside the guest. - run
- Runs the configured command under supervision and returns its exit code.
- send_fd 🔒
- Sends a descriptor over a unix socket with
SCM_RIGHTS. Allocation free. - wait_
root 🔒 - Waits for the first tracee and returns the exit code to report, reaping every other child along the way.