decisions DECIDED

265. A C library started from relibc, whose Rust platform layer holds the capabilities

The file name is a lane's coinage.

The ruling

The benchmark ruling on PR #1854 (nife is measured with the field's standard benchmarks) requires the standard benchmarks to run unmodified. The nine programs it mints as milestones 826 to 834 are all POSIX C. nife had no C library that runs one: §31 (the foreign-language seam) stops at tier two, malloc and free, and milestone 478 (tier three: full POSIX behind the foreign-language seam) was REFUSED until "a component somebody needs that cannot be adapted to the narrower tiers". Its nine are that component, nine times over, because adapting a benchmark is what that ruling forbids.

Four options were put to calef: A, keep 478's refusal and adapt the benchmarks; B, relibc, Redox's C library written in Rust; C, musl; D, picolibc or newlib. calef, 2026-10-08 (UTC):

B, although I suspect we end up building our own with a similar approach. We have different constraints than they do.

A loses to the benchmark ruling directly. C and D are C libraries whose system-call layer is C, so the C would make the system calls, which is the thing §31 exists to prevent. Giving them a Rust layer underneath means writing relibc's Pal seam again for a codebase not designed around one. relibc is the only one of the four built on that seam already.

What the evaluation found, and the shape it gives

notes/c-library.md measured relibc against nife's constraints before anything was built. Its recommendation, adopted here as the shape of the work (reversible, and calef's expectation made concrete):

§31 rule 1, amended

§31 rule 1 read: "The C makes no system calls and holds no capabilities." It now reads:

The C makes no system calls directly; the C library's platform layer, in Rust, holds the capabilities.

The C calls open. The library's Rust platform layer turns that into a filesystem_protocol request on the directory capability the process was granted. No C translation unit contains a syscall instruction. relibc's syscall() function and <sys/syscall.h> are not built for nife. The platform layer speaks the same protocol crates std speaks (notes/std.md), so the two runtimes cannot disagree about a wire format.

Why confinement still holds, and a correction to how §31 said it

§31 justified rule 1 as "a property of what it can name: a system call needs a capability slot, and the C never sees one." That overstated it, and the record is corrected here on purpose. A slot is a small integer, and the C shares an address space with the Rust code that holds the slots: a memory corruption bug in the C can overwrite the shim's state or reach its svc instruction. That was true of c_seam in July and it is true of a C library now.

What actually confines the C is the kernel, and it does not depend on the language or on the C's good behavior: a process can do exactly what its capability table allows, and nothing else. That is what §31's tests proved, from outside the faulting address space: the witness pages outside the grant were unchanged. Moving open behind a C library changes none of it. The worst a hostile or broken C program can do is everything its own process was granted, which is the same bound every Rust program on nife lives under. So the rule that carries the confinement is the one that was always carrying it: grant a C program only what it needs, by its program manifest (notes/program-manifest.md) and the slots its parent fills.

What rule 1 still buys, and why it is kept rather than dropped:

What this does not decide