Skip to main content
  1. Blog/

Rust in the Linux Kernel — From Experiment to Inevitability

·987 words·5 mins
Osmond van Hemert
Author
Osmond van Hemert
Systems & Emerging Languages - This article is part of a series.
Part : This Article

The Rust for Linux project has been quietly building momentum, and the latest patch series submitted to the Linux Kernel Mailing List (LKML) makes it clear this isn’t going away. Miguel Ojeda and the team have been steadily addressing reviewer feedback, improving the integration points between Rust and the kernel’s C infrastructure, and demonstrating that memory-safe systems programming in the kernel isn’t just theoretically possible — it’s practically achievable.

Why the Kernel Needs Rust
#

Let’s start with the fundamental motivation. A significant percentage of kernel vulnerabilities — Google’s security team has consistently cited around 70% — stem from memory safety issues. Buffer overflows, use-after-free bugs, null pointer dereferences, data races. These are the classes of bugs that Rust’s ownership model and borrow checker are specifically designed to prevent at compile time.

The Linux kernel is roughly 30 million lines of C code, maintained by thousands of developers with varying levels of experience. Even the best C programmers make memory safety mistakes — the cognitive overhead of manual memory management in complex concurrent code is enormous. I’ve written my share of C over the decades, and I’ll be the first to admit that the language makes it far too easy to introduce subtle memory bugs that might not manifest until years later under specific conditions.

Rust doesn’t eliminate all bugs, but it eliminates entire categories of them. In a codebase as critical as the Linux kernel, that’s transformational.

How the Integration Works
#

The Rust for Linux approach is pragmatic and well-designed. Nobody is proposing rewriting the kernel in Rust — that would be absurd for a 30-year-old codebase. Instead, the project enables writing new kernel modules and drivers in Rust, with safe abstractions over the existing C kernel APIs.

The architecture uses a layered approach. At the bottom, unsafe Rust bindings interact directly with kernel C functions through bindgen-generated interfaces. On top of those, safe Rust abstractions provide idiomatic APIs that kernel developers can use without writing unsafe code. A new driver author can work entirely in safe Rust while the underlying bindings handle the C interop.

This is the right approach. You get the safety benefits for new code without the impossible task of rewriting existing subsystems. Over time, as drivers are updated or new ones written, the proportion of memory-safe code in the kernel naturally increases.

The toolchain integration has also matured significantly. The project uses a specific version of the Rust compiler (currently targeting nightly, with plans to move to stable releases once certain features are stabilized), and the build system integration with Kbuild is surprisingly clean. You can configure which Rust support to enable alongside your normal kernel configuration.

The Cultural Shift
#

Perhaps more interesting than the technical work is the cultural shift happening within the kernel community. Linus Torvalds has expressed openness to merging Rust support, which is a significant signal. The kernel community is famously conservative — and for good reason, given the stability requirements — but there’s growing recognition that the status quo on memory safety isn’t sustainable.

Not everyone is on board, of course. Some veteran kernel developers have expressed concerns about adding a second language to the kernel, the learning curve for maintainers, and the complexity of debugging across language boundaries. These are legitimate concerns. Maintaining a mixed C/Rust codebase requires developers who understand both languages and the interaction between them.

But I think the trajectory is clear. The industry is moving toward memory-safe systems programming languages, and the kernel can either lead that transition or be dragged into it. Android has already committed to Rust for new platform code, and Microsoft has been experimenting with Rust in Windows components. The major OS vendors are converging on the same conclusion.

What This Means for Developers
#

Even if you never write kernel code, the Rust-in-Linux effort matters for a few reasons.

First, it validates Rust as a systems programming language for the most demanding environment possible. If Rust is good enough for the Linux kernel, it’s good enough for your systems work.

Second, the abstractions being developed for kernel use are pushing Rust’s type system and unsafe code patterns into new territory. The techniques being pioneered here — safe wrappers over C APIs, compile-time resource management for hardware interactions, zero-cost abstractions for kernel primitives — will eventually benefit the broader Rust ecosystem.

Third, and most practically, a kernel with more memory-safe code means fewer kernel vulnerabilities, fewer CVEs, fewer emergency patches, and more stable systems for everyone running Linux. That’s every cloud server, every Android phone, every embedded device, every container in your Kubernetes cluster.

My Take
#

I’ve watched programming language debates come and go. Usually they’re about developer productivity or ecosystem size or syntax preferences. The Rust conversation is fundamentally different because it’s about correctness — specifically, the kind of correctness that prevents security vulnerabilities and system crashes.

The Rust for Linux project represents something I find genuinely exciting: a pragmatic, incremental path to meaningfully improving the security and stability of the most important software on the planet. It’s not revolutionary in its approach — it’s evolutionary, which is exactly what makes it likely to succeed.

I’ve been writing more Rust in my own work over the past year, primarily for CLI tools and service components where performance and reliability matter. The learning curve is real, but the compiler’s guarantees fundamentally change how I think about code correctness. Seeing those same guarantees heading into the kernel feels like the beginning of a long-overdue shift.

If you’re a systems programmer who hasn’t tried Rust yet, the kernel project is another strong signal that now is the time. The language, tooling, and ecosystem have matured enough that the investment pays dividends. Start with something small — a CLI tool, a data processing pipeline — and let the borrow checker teach you a new way of thinking about memory and ownership. Your future self will thank you.

Systems & Emerging Languages - This article is part of a series.
Part : This Article