runbook: gVisor units' syscall deny-list and the /proc route
"What the host units contain" names the deny-list, what the witness now checks from inside each unit, and the CAP_SETUID /proc route as witnessed: the root half open (and why no unit setting closes it), the cgroup-namespace half refused at setns.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+33
−10
docs/superpowers/runbooks/gvisor-demos.md+33 −10
diff --git a/docs/superpowers/runbooks/gvisor-demos.md b/docs/superpowers/runbooks/gvisor-demos.md| index 1bad9b879..d306c0215 100644 |
| --- a/docs/superpowers/runbooks/gvisor-demos.md |
| +++ b/docs/superpowers/runbooks/gvisor-demos.md |
| @@ -121,8 +121,18 @@ The three runsc units run as root. Their host-side containment (F4) is: |
| - Each unit has its own cgroup namespace (`ProtectControlGroups=strict`). |
| - A measured capability bounding set, without `NoNewPrivileges=`, which |
| runsc refuses. |
| - |
| -These covers hold only for a process that has dropped `CAP_SYS_ADMIN`. |
| +- A list of system calls the unit may not make (`SystemCallFilter=`). A |
| + refused call fails with "function not implemented" (ENOSYS). The list |
| + covers kernel modules, reboot and kexec, swap, raw I/O ports, setting |
| + the clock, CPU emulation, obsolete calls, the kernel keyring, eBPF, |
| + perf events, userfaultfd, io_uring, opening files by handle |
| + (`open_by_handle_at`) and joining a namespace (`setns`). runsc needs |
| + ptrace and the mount calls, so those stay allowed. Of the listed calls, |
| + runsc makes only one, an io_uring check, and it carries on without |
| + io_uring. The guest does not see the list. |
| + |
| +These covers hold only for a process that has dropped `CAP_SYS_ADMIN` |
| +and cannot switch to a host user (see the open route below). |
| The gofer and sentry drop it once the sandbox is set up. The runsc parent |
| (`runsc run`, the unit's main process) and every hook (`runsc kill`, |
| `runsc delete`, `carlos instance-exit`) keep the whole bounding set, |
| @@ -142,14 +152,27 @@ It covers only the routes it tests: |
| parents only, not another unit's hooks or a build's parent. |
| - It cannot move itself into a cgroup outside its unit. A fresh cgroup |
| mount shows only the unit's own cgroup. |
| - |
| -Other routes are likely open. The set includes `CAP_SETUID`, so a child |
| -can switch to another user. It can then probably open `/proc/<pid>/root` |
| -or `/proc/<pid>/ns/cgroup` of a host process of that user that holds no |
| -capabilities, such as `carlos-relay` or an admin shell. Through the first |
| -it reads the host's files. Through the second, with `CAP_SYS_ADMIN`, it |
| -joins the host's cgroup namespace and leaves its unit's cgroup. The |
| -witness does not test these routes. |
| +- It cannot make any of the refused system calls. The witness tries |
| + eBPF, perf events, userfaultfd, io_uring, `open_by_handle_at`, |
| + `kexec_load`, the keyring, swap and `setns`, and each fails with |
| + "function not implemented". |
| + |
| +One route is open, and the witness checks that it is. The set includes |
| +`CAP_SETUID`, so a child can switch to another user. It can then open |
| +`/proc/<pid>/root` of a host process of that user that holds no |
| +capabilities, such as `carlos-relay` or an admin shell, and pass it back |
| +to its root parent. Through it the parent reads the host's files, |
| +`/etc/carlos` included, with or without `CAP_SYS_ADMIN`. No unit setting |
| +closes this route and still lets runsc run. runsc needs `CAP_SETUID` and |
| +the calls the route uses. Hiding the host's processes from `/proc` with |
| +`ProtectProc=` does not hide a process from its own user. `PrivatePIDs=` |
| +does hide them, but then each of the unit's commands runs in a process |
| +namespace of its own. runsc's stop and delete commands would then look |
| +for the sandbox under the wrong process IDs. |
| + |
| +The same child can open that process's `/proc/<pid>/ns/cgroup`. Joining |
| +it would take the parent out of its unit's cgroup, but joining needs |
| +`setns`, which the unit refuses. The witness checks that this fails. |
| A process that did leave its unit's cgroup would lose the unit's IP |
| filter, so the instance metadata service and the box's IAM role would be |