Moss: a Rust Linux-compatible kernel in 26,000 lines of code
Project scope and current capabilities
- Rust + a bit of assembly, ARM64-only so far; boots on QEMU and several dev boards.
- Aims for Linux user‑space binary compatibility; currently runs most BusyBox commands and tools like vim.
- Major gaps: only read‑only FAT32 filesystem, no networking stack yet, limited syscalls and drivers, not a drop‑in Ubuntu/Android kernel.
- Uses a
libkernelthat can run in user space for easier debugging of core logic (e.g., memory management), seen as getting some microkernel‑like development benefits in a monolithic design.
Rust async/await in the kernel
- Several comments explain Rust async/await as compiler‑generated state machines (
Futures) plus an executor, not tied to OS‑level threads or a heavyweight runtime. - Others argue that, in a Linux‑compatible kernel with real threads and schedulers, integrating async, work‑stealing, and multi‑CPU scheduling is non‑trivial.
- Embedded Rust frameworks (e.g., single‑threaded async RTOS‑like environments) are cited as evidence that async can work with minimal runtimes.
- One thread links this to historic coroutine‑style I/O frameworks, noting Rust removes much of the “hand‑rolled coroutine” pain.
Linux compatibility strategy
- “Linux‑compatible” here primarily means user‑space ABI: same syscalls and behavior where implemented, not internal kernel APIs.
- Missing syscalls currently cause a panic, prompting the author to implement them as they appear in real workloads.
- Commenters note this is a pragmatic way to focus kernel work on actually‑used syscalls without immediately recreating the full Linux toolchain.
Licensing debate (MIT vs copyleft)
- Large subthread: some fear an MIT‑licensed, Linux‑ABI‑compatible kernel will be forked by vendors, filled with proprietary drivers, and shipped on locked‑down hardware.
- Others counter that:
- GPL has not prevented widespread binary blobs in Linux, nor guaranteed contributions; enforcement is uneven.
- FreeBSD and other permissive kernels do get meaningful contributions from some large users.
- LLVM/Clang and many popular user‑space projects show permissive licenses can still attract corporate investment.
- Philosophical clash:
- Copyleft advocates stress protecting end‑user freedom and the “commons.”
- Permissive‑license advocates emphasize unconditional “gifts,” developer freedom, and reject moral pressure on the author’s choice.
Long‑term goals and questions
- Author mentions mid‑term goal of being self‑hosting (edit, fetch deps, and build Moss from Moss), and long‑term aspiration as a daily‑driver OS on chosen hardware.
- Commenters ask about outperforming Linux via different page sizes or interrupt strategies, adding networking (e.g., via smoltcp), reimplementing KVM, and comparisons with other Rust kernels.