What Rux is

A Linux-ABI-compatible operating-system kernel written from scratch in Rust Β· 679 files / 419,958 lines under kernel/ (408,864 of them Rust) Β· 349 system calls Β· LTP 1,139/1,869

Β§1Why I wrote a kernel myself

The Rust kernels that exist are usually one of three things: a teaching kernel, a microkernel prototype, or a compatibility claim expressed as a syscall-coverage number. What I want is concrete: the performance floor of a monolithic kernel, the Linux ABI as a binary contract, and Rust's auditable safety. All three, none optional.

Hence Rux. The code is public, and this page simply states what I built, how it is built, what the code looks like, and which parts are not finished.

The starting motivation is equally concrete: I ran a dozen agents in parallel on Ubuntu and the typing latency reached one to two seconds, which was not acceptable β€” rather than keep tuning someone else's kernel, I wrote my own. That motive decided the trade-offs that followed: the scheduler is a single global run queue (GRQ), designed by subtraction for personal devices with 8–16 CPUs, where it removes load migration and task stealing; a server kernel was never in scope.

Β§2ABI compatibility: not "how many syscalls", but "boot it"

My design principle in one line: the ABI is the contract; the internals are free.

Outward, everything userland can observe is contractual β€” syscall numbers and semantics, ELF and auxv, futex, POSIX and SysV IPC, binder, on-disk ext4, the procfs/sysfs/debugfs/tracefs layouts, down to the uname strings glibc's dynamic loader keys on. The current implementation has 349 system calls on the asm-generic table (the x86_64 native numbering translates onto the same table), and a full LTP scan of the 1,869-case list passes 1,139.

Inward, no constraint from the mainstream's internal history. Every internal design that differs from the common approach is written down with its compatibility evidence β€” 29 registered design divergences at present (the divergence register).

The verification method matters more than the count. A curated syscall subset proves nothing; unmodified distribution images prove everything:

DistributionResultRig
Ubuntu 22.04Interactive GNOME Shell desktop; the full chain passes a 2,100 s, smp4, zero-panic gateriscv64
Ubuntu 24.04systemd 255 reaches the multi-user and graphical targets, with serial loginx86_64 + KVM
OpenHarmony135+ services all come up, to an interactive launcher (bootanimation, hiview, the binder mesh, the input pipeline)x86_64 + KVM
No patches, no recompilation, no configuration changes. Syscall coverage is a number; an end-to-end boot is a fact.

Β§3AI-written code is an engineering method, not a slogan

I expect this one to be contested, so let me be precise: Rux's subsystems β€” scheduler, memory management, ext4, binder, the network stack, the verification harness β€” and all of the code, documentation and this site were written by AI. The human role is goal-setting, review and merge.

The working model: parallel agents, each with its own git worktree and branch, with the main session reviewing and merging; several merge rounds a day, each preceded by a full regression pass. About 200 worktrees are live at the moment. Merging has exactly one gate (AGENTS.md): three-architecture build, the full in-kernel suite, tiered performance gates and data-integrity batteries β€” a change lands with all of them or not at all.

This is not "an assistant filling in a few lines". It puts AI where subsystems get implemented and keeps the human at architecture review and the merge gate. Whether that model holds at 400,000 lines is still under observation. So far it has produced a complete kernel that boots a desktop from a real distribution.

Β§4Safety: not "Rust is safe", but the itemized bill

"Rust is safe" is a sentence everyone has heard too often. What is actually worth knowing is: what has gone wrong inside unsafe code, and how I manage it.

How large the unsafe surface is. kernel/src is 361,875 lines. Measured by the in-tree ledger script:

SeriesLinesShare
unsafe { … } block bodies25,7697.1%
unsafe fn / unsafe impl bodies27,0977.5%
dual series β€” the honest total50,63014.0%

In the layered view, kernel/src carries 5,224 unsafe tokens, of which 3,166 sit outside the Framework layer β€” that is the reduction target (47 files already carry #![forbid(unsafe_code)], and 63 more have no unsafe left at all). 63% of unsafe constructs carry a written // SAFETY: contract, and CI fails when a region appears in the tree without a ledger entry.

The defect history. 33 memory-corruption-class bugs over Rux's whole history, each adjudicated individually: 23 had the defect inside unsafe code or assembly, 10 were in safe code β€” and every one of those ten is an ownership, refcount, lock-protocol or stack-depth decision. The classes that dominate the CVE history of C kernels β€” indexing overrun, iterator invalidation, format-string injection, wild pointer arithmetic β€” are zero in safe code. Six of the 33 were caught in review before any boot ran them.

Formal verification. 164 Kani harnesses discharge the core unsafe code for all inputs; 1,184 host-side tests; loom enumerates the interleavings of the mutex, PI-chain and timer primitives; 4 SPIN models; Miri nightly.

"I am 90% safe Rust" is not the claim. The claim is: here is exactly what the remaining unsafe surface is, where it concentrates, and which tool watches it. That is auditable safety, not a slogan. See the security overview and the defect taxonomy.

Β§5Performance: same machine, same accelerator β€” the wins and the losses both published

Every row is a QEMU + KVM comparison on the same host with the same accelerator; numbers from different environments are never mixed into one line.

SuiteRux relative to Linux
lmbench, 27 rows13 ahead: semaphore 8.97Γ—, context switch 5.1–6.3Γ—, pipe 5.84Γ—, page fault 2.8Γ—, page-cache file read 1.45–1.54Γ—; 13 behind or at parity, the largest deficit file creation throughput at 22–26Γ—, then loopback socket latency at 2.1–2.2Γ—
Geekbench 5single-core 114%, multi-core 107% (4-CPU pinned comparison)
fio 3.364 KiB write + fsync 1.24Γ— ahead; 1 MiB buffered write 1.19–1.25Γ— ahead (11.7 GiB/s at 78 Β΅s/op); 1 MiB direct write 0.75–0.83Γ—, direct read 0.83Γ—
rt-tests v2.11cyclictest SCHED_OTHER average 1.5Γ— ahead; SCHED_FIFO minimum wins every clean pass, maximum 10Γ— ahead, average 1.15–1.3Γ— behind; hackbench 1.06–1.16Γ— ahead on all three forms; pi_stress runs 273k–383k priority inversions cleanly

The scheduler is a single global run queue (GRQ) with an explicit target: personal devices with 8–16 CPUs. The measured GRQ critical section is β‰ˆ60 ns and the buffer-cache hit rate is 99.1%. Performance gating is part of the merge flow β€” without measurement data nothing merges; performance is not a benchmark run afterwards, it is an admission condition for every change. The full boards and their method: performance overview.

Β§6What the 419,000 lines contain

  • Scheduler: the GRQ, sized for 8–16 CPU personal devices; critical section β‰ˆ60 ns; no load balancer, no task migration
  • Memory management: buddy page allocator with a magazine small-object allocator, a global page cache, per-task VMAs, reclaim
  • Filesystem: ext4 read/write, jbd2, an async batching block layer, a per-inode page cache and a lock-free dcache
  • IPC and binder: a complete binder (it carries OpenHarmony's whole service mesh), unix sockets, pipes, SysV IPC
  • Network: a self-written TCP/IP stack with socket-API semantics matched to the ABI
  • Drivers: virtio-blk (PCI and MMIO, async completion rings), serial, input devices; the display path renders both the GNOME desktop and the OpenHarmony launcher
  • Observability: a unified trace-event framework with tracefs (semantics aligned), a symbol table, debugfs, task dumps
  • Porting layer: x86_64 / riscv64 / aarch64; about 90% of the kernel is architecture-independent

Because the host can use KVM directly, x86_64 is the primary platform for both function and performance work, while riscv64 and aarch64 carry the build and regression gates. The in-kernel test suite is 1,584/1,584 green on riscv64, and the desktop session passes a 2,100 s zero-panic gate.

Β§7What is not finished

  • LTP: 1,139 of 1,869 pass; several hundred still fail. TIMEOUT cases are adjudicated one by one, and every failure that is not ours stays on record
  • lmbench: 13 rows trail, the largest at 22–26Γ—; 1 MiB direct write sits at 0.75–0.83Γ—. Each row carries a measured decomposition of the gap
  • The unsafe surface: 14.0% still depends on human review; the campaign targets ≀5,000 unsafe lines (≀1%) with a per-block irreducibility proof (docs/development/unsafe-5000-plan.md)
  • Kani covers the core unsafe code, not every key path; loom and SPIN cover the concurrency primitives
  • Whether the AI working model holds at 400,000 lines is under observation, not settled
  • The 29 registered divergences need their compatibility evidence kept current

All of this is stated on the site. Rux is not a finished product; it is an engineering effort in progress.

Β§8Closing

I am writing Rux first to test what AI-generated code can do, and second because I want one thing: the performance of a monolithic kernel, the Linux ABI as a binary contract, and Rust's auditable safety β€” all three at once. Progress so far looks good, and while I have the time I will keep updating it; the day it stops, it will be because I found a new hobby.

The code is on GitHub; start with Getting started, or go straight to the architecture.