Software & Apps

Rust replaces C for critical Linux kernel drivers

Linux kernel 7.0 established Rust as a stable language to mitigate memory-safety vulnerabilities that account for 70% of high-severity security bugs in major codebases. The transition enables hardware vendors to develop drivers using Rust's ownership model to prevent buffer overflows.

Rust replaces C for critical Linux kernel drivers

Memory safety in the kernel

Microsoft and Google report that 70% of high-severity security bugs in their codebases trace to memory-safety issues. The Linux kernel 7.0 release on April 12, 2026, established Rust as a stable language to mitigate these vulnerabilities. C still accounts for 99% of the Linux codebase. While C dominates, the transition to Rust allows developers to use the language ownership model and borrow checker to enforce safety at compile time. This approach prevents common errors like buffer overflows and use-after-free errors that have plagued Linux for decades. Miguel Ojeda, a Linux kernel developer, spearheaded the Rust for Linux group to facilitate this transition. Wedson Almeida Filho from Google’s Android team pushed for Rust in the kernel in April 2021 to reduce bugs in privileged code. He noted that Rust can join C as a practical language while preserving performance characteristics. The Rust for Linux initiative, which began in 2020, moved from experimental to stable after maintainers concluded the infrastructure stabilized during the kernel 6.15 development cycle. The decision to drop the experimental label occurred during discussions around the kernel 6.15 development cycle after maintainers concluded that the Rust infrastructure had stabilized sufficiently to support production-ready code across the mainline kernel. The Stack Overflow 2024 Developer Survey ranks Rust as the most admired programming language for nine consecutive years, with more than 80% of developers expressing interest in continuing to use it.

Driver development and hardware support

Hardware vendors use Rust to develop drivers for specialized components. The NVMe driver implementation required 70 extensions to Rust to function within the kernel. Andreas Hindborg, a Western Digital Principal Engineer, showed at the 2022 Linux Plumbers Summit that engineers could write a first-rate SSD NVM-Express (NVMe) driver in Rust. Google’s Android team developed a prototype Binder driver for inter-process communication to test safety and performance against the C version. Kernel 7.0 also expanded hardware compatibility by adding atomic 64-byte loads on ARM64 and security extensions for RISC-V.

Kernel Version Milestone
6.1 First Rust platform driver
6.2 NVMe driver
6.8 Rust abstractions for allocators and task management
7.0 Stable Rust integration

Driver development involves two main components: User Mode Drivers (UMDs) that implement APIs like Vulkan and Kernel Mode Drivers (KMDs) that manage hardware access. KMDs provide APIs for device queries, memory management, job submission, and hardware scheduling. By kernel 6.8, the team added abstractions for sequence locks, power management callbacks, memory I/O, IRQ chips, and high-level flow managers. They also implemented support for AMBA peripherals and drivers for GPIO PL061 devices. The project uses bindgen-generated bindings to automate much of the C-Rust glue code. For latency-sensitive systems, Rust provides performance without the runtime overhead of garbage collection.

Developer friction and maintenance

The inclusion of Rust creates tension among maintainers. Christoph Hellwig expressed skepticism about the inclusion of Rust, while Linus Torvalds stated he would merge the code regardless of opposition. The transition remains difficult because the strict ownership model creates a measurable learning ramp for engineers. One must master the borrow checker to avoid compile errors. The Rust type system uses sum types to handle optional values through the Option type, which prevents null pointer issues. Because the compiler enforces these patterns, code review focuses on design rather than memory hygiene. The 6,000-line Binder driver prototype provides a useful example of this capability. Developers must still adhere to Linux coding standards, using tools like KUnit for testing and sparse for static analysis. The project team also removed unstable features such as const_fn_transmute and core_panic by updating the compiler. You should evaluate your team’s capacity for a productivity dip before committing to a rewrite. Will the industry eventually replace C entirely? The implementation of Rust in the kernel is a strategic option for components handling untrusted input or requiring high performance.