Moss: A Rust-Based Kernel That Speaks Linux
If you've ever been curious about operating system development, you've probably felt the weight of C's legacy. It's powerful, but manual memory management and undefined behavior can make kernel work feel like walking a tightrope. What if you could build something low-level with the safety guarantees of a modern language?
Enter Moss, an experimental kernel written entirely in Rust. It's not just a toy or a proof-of-concept; it's a functional, monolithic kernel that's compatible with the Linux ABI. This means it can run standard Linux ELF binaries right out of the box. It's a fascinating look at what OS development can look like when you start with memory safety from the ground up.
What It Does
Moss is a monolithic kernel, similar in architecture to Linux, but implemented in Rust. Its standout feature is Linux ABI compatibility. The kernel provides its own implementations of core system calls and can load and run dynamically linked Linux executables (like those built for x86_64-linux-gnu). It handles the basics: memory management, process scheduling, interrupts, and has support for essential subsystems like a virtual filesystem (VFS).
It's important to note that Moss is not a fork of the Linux kernel, nor is it a Rust translation of it. It's a from-scratch implementation that chooses to be compatible at the system call interface. This is a clever approach that lets it tap into the vast ecosystem of Linux software while exploring a new, safer implementation path.
Why It's Cool
The cool factor here isn't just "Rust in the kernel." It's the specific design choice of Linux ABI compatibility. This project isn't building a walled garden; it's building a safe foundation under an existing, sprawling city of applications.
From a developer's perspective, this means you can experiment with kernel architecture and internals without giving up the ability to run common tools. Want to test your new scheduler? You might be able to run bash or coreutils on it to see how it feels. This dramatically lowers the barrier to entry for practical kernel hacking and research.
Furthermore, the codebase itself is a great learning resource. It's a relatively clean, modern example of how the core concepts of an OS (paging, context switching, syscall handling) can be expressed in Rust's ownership model. You get to see how the low-level nightmares of concurrency and memory are tamed by the compiler.
How to Try It
Ready to see it in action? The project is on GitHub and includes instructions for building and running Moss with QEMU.
Head over to the repository: github.com/hexagonal-sun/moss-kernel
You'll need a standard Rust nightly toolchain and QEMU installed. The repository's README provides the commands to build the kernel and the as