Expand description
Sandbox setup and exec for Cantainer.
plan completes a policy with what the executable needs to start (its ELF interpreter,
shared libraries and a small runtime base), filters the environment and builds argv.
exec then makes the kernel enforce the plan and replaces the current process with the
program:
- create writable command-line files that do not exist yet (so they have an inode),
- Landlock: deny by default, allow each grant (also sets
no_new_privs), - seccomp: baseline deny list plus the socket families the policy does not allow,
execve.
There is no supervisor process: exit status, signals and the terminal belong to the program, exactly as if it had been run directly. Restrictions are inherited by everything it starts and cannot be lifted.
Linux only. On other systems every entry point returns LaunchError::Unsupported, so the
workspace still builds on macOS for editing.
Structs§
- Kernel
Support - Facts about the running kernel, for
cant check. - Plan
- Everything needed to start a cant.
- Resolved
- What an executable needs from the filesystem to start.
Enums§
- ElfError
- Errors reading an executable.
- Launch
Error - Errors from planning or launching.
Constants§
- MIN_ABI
- Below ABI 3,
truncate(2)is not controlled, so a read-only grant would not stop a cant from emptying a file. We refuse to run rather than pretend. - POLICY_
ENV - Name of the environment variable carrying the effective policy into a cant, so that a
nested
cantcan explain and pre-check attenuation. It is informational: the kernel enforces the real restrictions, and a forged value cannot widen them. - RUNTIME_
READ - Files every dynamically linked program may need to read.
- RUNTIME_
READ_ WRITE - Devices every program may read and write.
Functions§
- exec
- Enforces
planand replaces the current process with the program. Returns only on failure.warnreceives non-fatal notices (printed by the CLI). - plan
- Completes
builtinto a launch plan. - probe_
kernel - Probes kernel support. On Linux this applies a no-op Landlock ruleset to the calling
process (the only way to learn the ABI through the
landlockcrate), so call it only from a process that is about to exit, such ascant check. - resolve_
libraries - Resolves the interpreter and all shared libraries of
binary.