Repository navigation
Add the sessionview launcher for per-Session views - #339
Merged
Merged
Conversation
The daemon re-executes itself into a launcher cloned into new mount, PID and network namespaces. The launcher mounts the world over /dev/fuse, hands the connection to the daemon's world server over SCM_RIGHTS, binds the private directories, overlays and shim onto symlink-free targets, adds /proc and a minimal /dev, moves the world onto /, drops privileges, installs a seccomp filter that denies user namespaces, setns and clone3, and runs the Harness as PID 1's only child. Mount flags alone decide what can be executed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
apps/daemon/internal/sessionview, the Linux launcher that runs one process inside a per-Session view on the agent host.How a view is built:
sessionview.Init()hook, into a launcher cloned into new mount, PID and network namespaces. The launcher is PID 1: it forwards signals, reaps orphans and exits with the process's status./dev/fuseconnection to the daemon'sWorldcallback over SCM_RIGHTS, so the daemon serves the file system from outside the view./.oac/*directories;/.oac/bin/<name>and over the declared absolute paths.openat2and the new mount API: no symlinks, stay beneath the view root./procand a minimal/dev(devpts, noexec/dev/shm).The exec guard is the one recorded in the spec after design review:
clone/unsharewithCLONE_NEWUSERandsetnsreturn EPERM,clone3returns ENOSYS, and any arch other than amd64 or arm64 is killed.doc.gosays so.Every construction failure is typed.
Probechecks the host (SYS_ADMIN, NET_ADMIN,/dev/fuse, seccomp). On other OSes the package compiles, andStartreturns ErrUnsupported.Checks:
docker run --cap-add SYS_ADMIN --cap-add NET_ADMIN --device /dev/fuse --security-opt apparmor=unconfined. The tests cover:/bin/sh;/proc;Part of the agent-outside-sandbox work, milestone M1, lane L4.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.