If you have ever poked around inside the Linux kernel folder, you know it only holds two languages: C and Assembly. That arrangement has held for more than three decades. Linus Torvalds is famously protective of his codebase, and it is not only a matter of taste.
When someone proposed adopting C++ on the kernel mailing list, the answer was harsh and gets quoted to this day. The reasoning is classic: design complexity, compile overhead, and C++ memory management that he judged unpredictable in kernel space. His favorite point at the time: any language happy to hide memory allocation behind the reader's back is not a good choice for a kernel.
Then, at the end of 2022, something that would have sounded impossible three decades earlier happened. Through the Rust for Linux initiative, Rust officially entered the main tree of Linux 6.1. Not a casual patch stuck on a mailing list, but infrastructure that really got merged: around 12,500 lines for the scaffolding alone, with not a single driver yet. 🎉
Since then the discussion has not stopped. Is this a real revolution in operating system architecture, or just the pull of the "Rewrite It In Rust" (RIIR) meme? Let's break it down from the technical side, the vulnerability mitigation, and the reality of adoption in the industry. 🙂
Key takeaways
- Rust entered the Linux kernel not to follow a trend, but because CVE data shows that around 65-70% of security holes in memory-unsafe languages come from memory management mistakes.\n- The target was chosen deliberately in hardware drivers, the largest part of the kernel, the one that changes fastest and gets the loosest supervision.\n- The results are already measurable on Android: the share of memory vulnerabilities fell from 76% in 2019 to 24% in 2024, and under 20% in 2025.\n- C remains the foundation of the kernel, and Rust plays the part of a safety layer at the most exposed points, not a replacement.
Why was Rust only accepted now?
A clarification first, so nothing gets misunderstood: Linux is not being rewritten into Rust. The Linux kernel now sits at around 40 million lines of code. According to Greg Kroah-Hartman, the core part that everyone runs is only about 5% of that number. The rest is hardware support: drivers, architectures, and chips from hundreds of vendors.
So why did Linus soften? The answer sits in one chronic problem that has haunted the software industry for decades: memory safety.
The data is fairly consistent across projects. Alex Gaynor collected CVE analyses from several vendors, and the result was uniform at 65-70%. A sample of Ubuntu kernel CVEs over six months counted 65% memory unsafety, while Microsoft cites around 70% of the CVEs they assign each year as coming from there. For a project the size of a kernel, that is not a number you can ignore.
The shape of the mistakes is not very varied either. All of it is daily vocabulary for anyone who has written C:
- use-after-free — touching memory that has been returned to the system
- buffer overflow — writing or reading data past the edge of a buffer
- double free — releasing the same memory block twice
- data race — several cores changing the same data without synchronization
In user space, a bug like this usually ends in a crash or a Segmentation Fault. At ring 0, one wild pointer can trigger a kernel panic directly. It can also corrupt a filesystem, or open a path for an attacker to sit in the root chair.
What it actually targets: the jungle of hardware drivers
Many people assume Rust is being used to replace the CPU scheduler, the virtual memory manager, or core filesystems. The target is far more specific: device drivers.
The logic is simple. That 5% core is handled by a tight group of maintainers who watch each other. The other 95% is drivers: GPUs, Wi-Fi modules, NVMe controllers, Bluetooth adapters, sensors, written by thousands of engineers from various hardware vendors. Their coding standards and testing discipline vary a lot, because no single committee supervises all of it.
On top of that, driver code changes fastest, and memory bugs show up most often in code that was just touched. So the most exposed area is exactly the area that is hardest for humans to supervise. That is where Rust's ownership and borrow checker get to work: reference mistakes are rejected at the compile stage, not discovered three years later when someone reports a kernel panic on a production machine.
// Example of a basic driver module structure in Rust for Linux (6.1-era API)
use kernel::prelude::*;
module! {
type: InvaSampleDriver,
name: "inva_sample_driver",
author: "Invasikode Team",
description: "Contoh registrasi modul driver minimalis berbasis Rust di kernel Linux",
license: "GPL",
}
struct InvaSampleDriver;
impl kernel::Module for InvaSampleDriver {
fn init(_name: &'static CStr, _module: &'static ThisModule) -> Result<Self> {
pr_info!("Rust driver berhasil diinisialisasi ke dalam kernel Linux!\n");
Ok(InvaSampleDriver)
}
}
impl Drop for InvaSampleDriver {
fn drop(&mut self) {
pr_info!("Resource driver dibersihkan secara otomatis dan deterministik!\n");
}
}
Look at the impl Drop. In C, unloading a driver module means you have to remember to free
everything you allocated in module_exit, one item at a time, on a path that is rarely tested. In
Rust, the Drop implementation ensures hardware resources are released when the module is
unloaded, and the compiler rejects code that leaves a dangling reference behind.
One note if you want to try it yourself: the init() signature in that example follows the
6.1-era API. In newer releases the
argument is just &'static ThisModule, and there was even a proposal to drop that argument entirely.
Match it against the kernel documentation you are using
before you copy-paste from any article, including this one. 😅
The second factor rarely discussed: maintainer regeneration
Beyond security, there is a human reason that matters just as much.
The core maintainers of the Linux kernel are mostly veteran engineers who have looked after C subsystems for 20 to 30 years. Meanwhile, the current generation of developers grew up with different language standards: integrated package management, interactive documentation, expressive type systems, and tooling that understands what the code means. A language that offers none of that feels like unpaid overtime.
Supporting Rust at the kernel level is a strategic move to welcome a new generation of operating system developers. The goal is to make sure someone wants to take over the world's computing infrastructure before the C generation retires. For a project older than many of its readers, that is not a luxury but a question of continuity.
RIIR outside the kernel: a win on the CLI, overreach elsewhere
Outside the kernel, enthusiasm for Rust gave birth to a movement known as RIIR. In the developer tools ecosystem, it has proven itself for real:
- ripgrep (
rg) became the new standard replacinggrep, fast because its regex engine uses finite automata plus SIMD optimization - fd replaces
findwith a more intuitive interface and built-in parallel directory reading - bat brings a modern version of
catwith syntax highlighting and Git integration - Bundlers and compilers like SWC, Biome, and Turbopack rewrite the JavaScript and CSS toolchain in Rust, claiming build time cuts of up to a dozen times
For that last point, there is a caveat you should know first. Vercel's "10x faster" number was disputed by Evan You because the benchmark compared things that were not equal: the Vite implementation still used Babel, while Turbopack and Webpack both used SWC. What still stands is the architectural reason: native parallelism and incremental computation in Rust remove the single-thread limit that held Node.js tooling back. The exact number depends on your own project, so measure it, don't trust the slide.
The extreme side shows up when RIIR is used to rewrite a project that has been stable for decades with no clear technical urgency. Rewriting proven code for the sake of a language trend often burns enormous engineering cost with no measurable gain in value. The difference from the kernel case: there the CVE data is clear, while in many other RIIR projects there is only a feeling. 🤔
So, revolution or just hype?
Rust's presence in Linux 6.1 is not a passing hype. It is a measured adaptation by the largest open source project in the world.
Look at the evidence on Android. Google pushed Rust for low-level system code there, and the result is measurable: the share of memory security holes fell from 76% in 2019 to 24% in 2024, then under 20% in 2025. Their latest report also records that memory vulnerability density in Rust code is more than a thousand times lower than in C and C++. For medium to large changes the rollback rate is four times smaller, and code review time runs 25% shorter. The 76% and 24% figures themselves come from their post a year earlier. The investment in Rust has proven cheaper than patching zero-days in production.
But don't misread the direction. C remains the foundation that has not been replaced. Its portability to any processor architecture and its simple toolchain have no equal to this day. The Linux kernel is not being rebuilt either: Rust comes in through the side door, in the areas most prone to bugs and least supervised, one driver at a time.
So the answer is: not a revolution, and not hype either. Rust did not come to kill C, but to patch its weaknesses at the points that crack most easily. At those points, help from anyone willing to write it is exactly what is needed. Happy driver hacking, and may what you write never need a reboot to reveal its mistakes. 👋