Security overview

The security argument's hub: the thesis, the four sub-pages' map and the headline numbers — every claim carries its mechanism, data and source on a sub-page · Living document: docs/architecture/safety-and-performance.md (evidence collected every merge round)
The memory-safety architecture document (2026-11-20): docs/architecture/memory-safety-architecture.md.One document for the whole memory-safety design: the six defense layers — L1 language isolation, L2 syscall boundary, L3 privilege model, L4 hardware aids, L5 formal verification, L6 runtime mitigation — each backing the one above it (the language removes defect classes → typed primitives shrink unsafe to single audited edges → the compiler-enforced service boundary → the lock protocol removes concurrency failure shapes at the source → hardware turns the residual classes into guaranteed faults); the two-numbers measurement — unsafe block lines 7.1% (25,769 lines), 14.0% on the dual series including unsafe fn/impl bodies (50,630 lines), banked every round, only allowed to go down, ending at ≤5,000 lines / ≤1% with a per-block irreducibility proof; and the six process rules — soundness boundary = module boundary, detectors report but never repair, no prints on hot paths, release builds ship with debug features off, a third recurrence of the same defect shape triggers a primitive-design review, every historical defect individually adjudicated. The full text covers the threat model (all 33 historical corruption bugs adjudicated), the primitive catalogue with invariant contracts, the lock protocol, and the honest gaps list.Read the full document (GitHub) ↗

§1The thesis

Security checks happen at compile time and disappear from the fast path — the fast design and the safe design are the same design.Traditional kernels trade safety for speed on the hot path; this kernel moves the checks into the type system and build time, so the fast path no longer pays for them. §5 below gives the per-item "performance result ← the security property it carries" pairing.

§2The argument structure (four sub-pages)

Sub-pageQuestion answeredHeadline
Layered unsafe ledgerHow large is the memory-safety TCB, where is it, what process constrains it?7.1% unsafe block lines (376 files / 4,331 blocks; 25,769 of 361,875 lines), 14.0% on the dual series (with unsafe fn/impl bodies, 50,630 lines); the Framework/Service layering, 47 forbid files, a monotone-down budget
Defect taxonomyWhat have the historical defects actually looked like, and where did they live?all-history 33 defects adjudicated: 23 unsafe/asm + 10 safe ownership-class; pointer-expression classes 0; 6 caught by review pre-boot
Formal verificationWhat machine verification exists beyond human review?Kani 164 harnesses · SPIN 4 models · loom 8 scenarios · Miri · 1,184 host tests; the mirror-sync discipline pins proof validity
Hardening & gapsWhich runtime defenses exist? What is missing and what does closing it look like?the six-layer model 5/6 present; the 21-row posture = 7 present/3 quick/10 project/1 accepted; every gap with its closure shape

§3The composite argument: why these numbers amount to "safe enough"

  1. Class elimination (compile time): the expression-level defect classes dominating C-kernel CVE history (overruns/iterator invalidation/wild pointer arithmetic/format strings) are unrepresentable in safe code — the taxonomy's 0 is that claim's empirical face; the unsafe surface is 14.0% (dual series) and audited block by block.
  2. The residual class has dedicated countermeasures: the 10 safe-class defects are all ownership/refcount/lock-protocol/stack-depth decisions — precisely the targets of model checking and symbolic execution: loom's interleaving enumeration (caught a real lock-protocol defect in its first 90 seconds), Kani proving invariant tables for all inputs, proptests pinning scoring/encoding/algebra rules.
  3. Proof validity is process-guaranteed: the mirror-sync discipline makes kernel-vs-mirror drift fail the build directly — a proof cannot silently stop covering its code; the CI layering (light per-push + heavy nightly) ensures the instruments actually run.
  4. The defect surface is designed: panic paths contained instance by instance (a dozen-plus regression receipts); instrument misjudgments and negative results archived with receipts — the adjudication discipline is itself audited.
  5. Runtime defenses + honest gaps: SMAP/SUM/exception tables/seccomp/capabilities/stack guards present with measured costs; the gaps (KASLR, text W^X, stack protection etc.) each state their closure shape rather than being avoided.

§4The headline table

MetricValueSource
Memory-corruption defects (all history, adjudicated)33 (23 unsafe-class / 10 safe ownership-class)taxonomy §2
Pointer-expression defects (safe code)0taxonomy §2
unsafe line share / unsafe blocks7.1% (25,769/361,875 lines) / 4,331 blocks · dual series 14.0% (50,630 lines)ledger §3
Compile-time forbid(unsafe_code) files47 (+56 files already unsafe-free)ledger §4
Kani harnesses (all-input proofs)164 (34 files) / ~150 invariant familiesformal §2
SPIN models / loom scenarios4 models all PASS / 8 scenarios (3 planted must-catch)formal §3-4
Host property tests + unit tests1,184 (incl. proptest!) + 1,584 in-kernelformal §5
loom's captured real kernel defect90 s after first arming (011a71c5, a mutual-exclusion break)formal §4
Posture rows (present/quick/project/accepted)7 / 3 / 10 / 1hardening §5

§5Security × performance pairing evidence

Performance result (same-test platform A/B)The security property it carries
Context switch −58% (three optimizations)the switch path carries typed per-CPU storage (D-7: guard lifetime = the IRQ-off window) + keyed locks (D-11: nesting order a compile fact)
GRQ hold 2786 ns @ 126M syscallsa single global structure = forensicability (D-1; the OH campaign's scheduler defect families were actually located on it) + a per-boot census verdict
timer nanosleep 772.6→662.7 ms (D-19)six historical defect classes (mixed clock domains / periodic misuse / double cancels / stale ids) became compile errors
stat 0.643→0.423 µs (the WalkClaim lockless read)reader-bank publication + deferred retirement, no dangling-reference window; the first landing reverted on an existing defect and re-landed hardened (history on record)
munmap 177→52 µs (the leaf-table direct walk)the chunked TLB-flush race family closed with it; the OH crash storm 66 SEGVs/boot → 3/3 clean
lmbench same-test platform 10 cases ahead (fault/pipe/switch/semaphore family) + Geekbench multi-core 110%all of it runs on the D-1/D-7/D-11 structures — the fast path IS the safe path
All evidence is recorded with its change in docs/architecture/safety-and-performance.md (the living document) and docs/architecture/rust-native-register.md (the measured-architecture register — an entry without a number is a placeholder).