Internals
How cell is built, for people who want to hack on it.
Architecture
cell (one binary)
├── machin — CLI surface, config, proxy, evidence, JSON output
└── embedded C shim — the syscall choreography
├── clone() dance: userns+pid+mount+ipc+uts+cgroup+net namespaces
├── rootfs assembly: tmpfs + ro binds + pivot_root
├── seccomp BPF, landlock, cgroup v2, fd hygiene
└── SCM_RIGHTS fd passing for the egress listener
This is the same architecture runc uses (machin replaces the Go, the shim is the nsexec equivalent), compressed into a single static binary with zero runtime dependencies.
Why raw clone() and not unshare/runc/bwrap
The point of the project is the primitive cell: the thinnest possible isolation boundary with no intermediary. Every millisecond and every line of code in the path is accounted for. At ~4ms per jail end-to-end, cells are cheap enough to be disposable per-command — a different cost shape than containers (~300ms+) or microVMs (~50-130ms).
Layout
| file | role |
|---|---|
src/cell.src | machin CLI: flags, output contract, feedback, guide |
src/proxy.src | egress proxy, policy, relay |
src/shim.h | child-side syscall choreography |
src/parent.h | host-side spawn/wait/reap/audit |
src/netproxy.h | SCM_RIGHTS fd passing, resolve FFI |
src/seccomp.h | hand-written BPF blocklist |
src/landlock.h | strict-writes layer |
src/cgroup.h | delegation detection, limits |
src/audit.h | evidence record writing |
tests/threat.sh | the threat harness — 48 attack checks |
tests/mutants.sh | mutant testing: planted bugs must be caught |
tests/multihost.sh | fleet matrix runner |
Testing philosophy
The harness attacks, it does not test features. Each check is a containment property a semi-trusted payload must not break. Mutant testing proves the harness can fail: plant a bug in the shim (drop CLONE_NEWNET, skip seccomp, skip fd hygiene), the harness must catch it. 7/7 currently.
The multi-host matrix exists because seccomp arch behavior, userns availability, cgroup delegation, mount-flag locking and landlock ABI are all host-sensitive. Green on the dev laptop proves nothing: the matrix has caught three real bugs invisible to single-host testing.
Deeper reading
- design.md — full design notes including the v0.1–v0.5 lessons
- vision.md / north-star.md — what cell is and is not for
- roadmap.md — where it’s going, including the credential-brokerage design question
- spore — sibling research at the other end of the spectrum: a KVM supervisor that brings its own kernel instead of sharing the host’s. Early research, not a product
Contributing
Build with machin ≥ 0.149, keep every source file under 500 lines, and any isolation-affecting change must keep tests/threat.sh green (57 checks) plus survive tests/mutants.sh. Feedback goes through cell feedback or GitHub issues.