sandlock
sandlock copied to clipboard
The lightest sandbox. A process-based sandbox for Linux, no container, no VM, no privilege, no prompt injection
With `-r /proc`, the open handlers match the path string the child wrote and return `Continue`; the kernel resolves links afterwards. ``` cat /proc/1/cmdline -> Permission denied cat /proc/self/root/proc/1/cmdline ->...
When the main child exits, the supervisor returns and releases the seccomp listener, but nothing sweeps the sandbox's process group. Any descendant still running is reparented and keeps going after...
Every teardown path reaches the sandbox through its process group: `sandlock kill`, `Sandbox::kill`/`pause`/`resume`, `Drop for Sandbox`, and the OCI supervisor all use `killpg(child_pid, ...)`. Nothing filters `setsid` or `setpgid`, so...
`PR_SET_PDEATHSIG` is set on the first child only and is not inherited across fork, so when the supervisor is killed with SIGKILL its grandchildren keep running: ``` timeout -s KILL...
Only the dump forms are synthesized (`netlink/synth.rs`); a lookup by name or index gets `EOPNOTSUPP`: ``` sandlock run -r /usr -r /proc -- ip link show lo -> Device "lo"...
With any `--fs-deny` active and `/proc` readable, the child's `/proc/self` is the supervisor's, including its environment. ``` $ SUPMARK=topsecret sandlock run -r /usr -r /lib -r /lib64 -r /bin -r...
With any `--fs-deny` active, opening a FIFO stalls the whole sandbox until it is killed. ``` $ D=$(mktemp -d) $ sandlock run -r /usr -r /lib -r /lib64 -r /bin...
When a profile contains `/proc/self/maps`, Landlock grants the inode of `/proc//maps` at rule-apply time. Any subprocess the workload forks has a different `/proc//maps` inode and is denied. The fix is...
`mkdir /root/foo` (direct write to existing /root) is recorded with a NOTE. But `open("/root/foo/bar", O_CREAT)` with `/root/foo` missing goes through the ancestor walk, reaches `/root`, and hits the Protected skip...
Requested by @SuperManito. Currently they are exclusive, because --net-allow means defaulting to deny, --net-deny mean defaulting to allow. Although combining them could be powerful, the logic might be too complicate...