Recent from talks
Contribute something
Nothing was collected or created yet.
Rust for Linux
View on Wikipedia| Rust for Linux | |
|---|---|
The mascot of Linux, Tux, superimposed over Rust's logo | |
| Developers |
|
| Initial release | October 1, 2022 |
| Repository | github |
| Written in | Rust |
| Operating system | Linux |
| Available in | English |
| License | GPL-2.0-only with Linux-syscall-note. |
| Website | https://rust-for-linux.com/ |
Rust for Linux is an ongoing project started in 2020 to add Rust as a programming language that can be used within the Linux kernel software, which has been written using C and assembly only. This project aims to leverage Rust's memory safety to reduce bugs when writing kernel drivers.[1] Progress has been slower than hoped by both Rust advocates and Linus Torvalds, lead of the Linux kernel project.[2] In December 2023, the first drivers written in Rust were accepted, and released in version 6.8.[3][4] In December 2025, it was announced that Rust in the Linux kernel is no longer experimental.[5]
History
[edit]The Linux kernel has been primarily written in C and assembly languages since its first release in 1991. Around 1997, the addition of C++ was considered and experimented upon for two weeks before being scrapped.[6] Rust was created in 2006 and combines the performance of low-level programming languages (such as C) with a focus on memory safety and a user-friendly tool set and syntax.[7]
An example Linux external loadable kernel module created using the Rust language was published by Taesoo Kim in 2013.[8][9]
The Rust for Linux project was announced in 2020 in the Linux kernel mailing list with goal of adding Rust as a programming language that could be used within the Linux project.[10] At the Open Source Summit 2022, Linus Torvalds stated that the incorporation of the project's work could begin as soon as the Linux 5.20 release, later named as Linux 6.0.[11] The first release candidate for Linux 6.0 was created on 14 August 2022, without Rust support. In the release notes for Linux 6.0-rc1, Torvalds expressed his intention for adding Rust support, "I actually was hoping that we'd get some of the first rust infrastructure, and the multi-gen LRU VM, but neither of them happened this time around."[12][13] On 19 September 2022, an article from ZDNet revealed an email from Linus Torvalds stating that "Unless something odd happens, it [Rust] will make it into 6.1".[14]
In October 2022, a pull request for accepting the implementation for Rust for Linux was approved by Torvalds.[15] As of Linux 6.1, support was intentionally left minimal in order to allow developers to test the feature.[16]
Rust for Linux developers created a new library "pinned-init" to safely and fallibly initialize memory that must not be relocated.[3] It was first included in Linux 6.4,[17] and been improved in later versions.[3]
Linux 6.10 included RISC-V processor architecture support for Rust.[18]
In July 2024 a change was accepted into Linux to support multiple Rust versions for the first time, allowing compiling using both 1.78 (Released 2 May, 2024) and 1.79 (Released 13 June, 2024).[19]
As of August 2024[update], Rust for Linux depends on unstable features of the Rust compiler.[1]
In December 2025, during the Linux Kernel Developers Summit, it was decided to promote Rust from experimental to a core part of the kernel.[5] This expands the core languages in the Linux kernel to C, assembly and Rust.
Usage
[edit]
Linux kernel contains the following Rust components:
- rnull, a drop-in replacement for the null device[3][20]
- ASIX AX88772A and Realtek Generic FE-GE physical layer network drivers[3][4][21][22]
- QR code DRM kernel panic handler[19][23]
Other notable projects using Rust in Linux include:
- tarfs, a tar filesystem[3][24]
- NVM Express (NVMe) device driver[3]
- Android Binder IPC driver[10][3][25]
- Asahi Linux's Apple silicon AGX GPU DRM driver[26][3][27]
- PuzzleFS, a container filesystem[3][28][24]
- Read-only ext2 filesystem[24]
- Nova, intended to create a Rust nouveau Nvidia GPU driver, is being developed on the freedesktop.org project infrastructure[29][30]
See also
[edit]References
[edit]- ^ a b Vaughan-Nichols, Steven. "Rust in Linux: Where we are and where we're going next". zdnet. Retrieved 31 August 2024.
- ^ "Linus Torvalds talks AI, Rust adoption, and why the Linux kernel is 'the only thing that matters'". zdnet. 23 August 2024. Retrieved 31 August 2024.
- ^ a b c d e f g h i j Li, Hongyu; Guo, Liwei; Yang, Yexuan; Wang, Shangguang; Xu, Mengwei (1 July 2024). "An Empirical Study of Rust-for-Linux: The Success, Dissatisfaction, and Compromise". usenix. ;login:. Retrieved 4 September 2024.
- ^ a b Das, Ankush (11 March 2024). "Linux Kernel 6.8 Released! Goes Big On Hardware Support". news.itsfoss.com. Retrieved 4 September 2024.
- ^ a b Leemhuis, Thorsten (Dec 10, 2025). "Linux Kernel: Rust Support Officially Approved". heise.de. Retrieved 12 December 2025.
- ^ Claburn, Thomas (2022-06-23). "Linus Torvalds says Rust is coming to the Linux kernel". The Register. Archived from the original on 2022-07-28. Retrieved 2022-07-25.
- ^ Perkel, Jeffrey M. (2020-12-01). "Why scientists are turning to Rust". Nature. 588 (7836): 185–186. Bibcode:2020Natur.588..185P. doi:10.1038/d41586-020-03382-2. PMID 33262490. S2CID 227251258. Archived from the original on 2022-05-06. Retrieved 2022-08-04.
- ^ Vaughan-Nichols, Steven J. (5 October 2022). "Rust in the Linux Kernel". thenewstack.io. Retrieved 31 August 2024.
- ^ Ojeda, Miguel (23 June 2022). "Memory Safety for the World's Largest Software Project". Retrieved 31 August 2024.
- ^ a b Simone, Sergio De (2021-04-27). "Using Rust to Write Safe and Correct Linux Kernel Drivers". InfoQ. Archived from the original on 2022-09-22. Retrieved 2022-08-04.
- ^ Vaughan-Nichols, Steven (2022-06-27). "Linus Torvalds is cautiously optimistic about bringing Rust into Linux kernel's next release". ZDNet. Archived from the original on 2022-08-12. Retrieved 2022-08-04.
- ^ Tung, Liam (2022-08-15). "Linux 6.0 arrives with performance improvements and more Rust coming". ZDNet. Archived from the original on 2022-09-07. Retrieved 2022-09-07.
- ^ Torvalds, Linus (2022-08-14). "Linux 6.0-rc1". LWN.net. Retrieved 2022-09-07.
- ^ Vaughan-Nichols, Steven (2022-09-19). "Linus Torvalds: Rust will go into Linux 6.1". ZDNET. Archived from the original on 2023-01-19. Retrieved 2022-09-20.
- ^ Proven, Liam (2022-10-05). "Linux 6.1: Rust to hit mainline kernel". The Register. Archived from the original on 2022-10-12. Retrieved 2022-10-12.
- ^ Corbet, Jonathan. "Next steps for Rust in the kernel". LWN.net. Archived from the original on 2023-06-08. Retrieved 2023-05-03.
- ^ Larabel, Michael. "More Rust Code Readied For Linux 6.4". phoronix.com. Retrieved 31 August 2024.
- ^ Knop, Dirk (July 27, 2024). "Linux-Kernel 6.10: Verbesserte Dateisysteme und neue Treiber". heise.de. Retrieved 31 August 2024.
- ^ a b Leemhuis, Thorsten (Aug 29, 2024). "Linux kernel gets "blue screens" with QR code". heise.de. Retrieved 31 August 2024.
- ^ Larabel, Michael. "Rust Null Block Driver Published To Begin Experimenting With Rust For Linux Storage". phoronix.com. Retrieved 31 August 2024.
- ^ Larabel, Michael. "The First Rust-Written Network PHY Driver Set To Land In Linux 6.8". phoronix.com. Retrieved 31 August 2024.
- ^ "Rust abstractions for network PHY drivers". Retrieved 31 August 2024.
- ^ "Add a QR code panic screen". Retrieved 16 June 2025.
- ^ a b c Larabel, Michael. "Microsoft Engineer Ports EXT2 File-System Driver To Rust". phoronix.com. Retrieved 31 August 2024.
- ^ Filho, Wedson Almeida (April 14, 2021). "Rust in the Linux kernel". Google Security Blog. Retrieved 31 August 2024.
- ^ Corbet, Jonathan (2 September 2024). "Whither the Apple AGX graphics driver?". LWN.net. Retrieved 5 September 2024.
- ^ Larabel, Michael. "Initial Rust DRM Abstractions, AGX Apple DRM Driver Posted For Review". phoronix.com. Retrieved 31 August 2024.
- ^ Larabel, Michael. "PuzzleFS Continues Striving To Be The Best File-System For Containers". phoronix.com. Retrieved 31 August 2024.
- ^ Das, Ankush (21 March 2024). "Red Hat Unveils a Rust-based 'Nova' Driver: A Better Nouveau for Nvidia GPUs". news.itsfoss.com. Retrieved 4 September 2024.
- ^ Larabel, Michael. "Red Hat's Long, Rust'ed Road Ahead For Nova As Nouveau Driver Successor". phoronix.com. Retrieved 31 August 2024.
Rust for Linux
View on GrokipediaBackground
The Rust Programming Language
Rust is a systems programming language initially sponsored by Mozilla Research and now maintained by the Rust Foundation and its community, designed to deliver performance comparable to C while enforcing memory safety and preventing common programming errors such as null pointer dereferences and data races at compile time.[11] This approach allows developers to write efficient, low-level code without the overhead of a garbage collector or runtime system, making it suitable for resource-constrained environments. By leveraging compile-time checks, Rust aims to eliminate entire classes of bugs that plague traditional systems languages, promoting reliable software development without sacrificing speed. The language originated as a personal side project by Graydon Hoare in 2006 while he was employed at Mozilla, evolving from his interest in safe and concurrent programming paradigms. Mozilla began officially sponsoring the project in 2009, providing resources for its growth into a full-fledged language. The first stable release, Rust 1.0, arrived on May 15, 2015, marking a commitment to "stability without stagnation" through regular six-week release cycles. As of November 2025, Rust has reached version 1.91.1, incorporating stabilized features such as async/await syntax for asynchronous programming, which had been introduced in earlier editions.[12] At the core of Rust's design are its ownership model, borrowing rules, lifetimes, and the borrow checker, which collectively ensure memory safety without runtime costs. The ownership model assigns a single owner to each value, automatically handling deallocation when the owner goes out of scope to prevent memory leaks and use-after-free errors. Borrowing rules allow temporary references to data—either mutable or immutable—without transferring ownership, but enforce strict constraints: only one mutable borrow or multiple immutable borrows can exist simultaneously, avoiding aliasing issues. Lifetimes, denoted by annotations like'a, track the validity of references to ensure they do not outlive the data they point to. The borrow checker, a key component of the Rust compiler, verifies these rules at compile time, rejecting unsafe code patterns and guaranteeing memory safety.
Rust's relevance to systems programming stems from its zero-cost abstractions, which provide high-level constructs like iterators and pattern matching that compile to efficient machine code without runtime penalties, matching C's performance in benchmarks for compute-intensive tasks. Additionally, it enables "fearless concurrency" through the Send and Sync traits: Send marks types safe for transfer between threads, while Sync ensures safe shared access across threads, preventing data races by design and allowing developers to leverage parallelism confidently. These features make Rust particularly appealing for building concurrent, high-performance applications in systems contexts.
Linux Kernel Overview
The Linux kernel is a monolithic yet modular operating system kernel originally developed by Linus Torvalds as a personal project in 1991 to create a free alternative to proprietary Unix-like systems.[13] It is primarily written in the C programming language, with small portions in assembly language for performance-critical sections such as low-level hardware interactions.[14] This design combines the efficiency of a monolithic kernel—where core services run in a single address space for direct hardware access—with modularity, allowing dynamic extension without recompiling the entire kernel.[15] At its core, the Linux kernel comprises several fundamental subsystems that manage system resources and operations. These include memory management, which handles virtual memory allocation, paging, and swapping to optimize resource utilization; process scheduling, which determines task execution order using algorithms like the Completely Fair Scheduler (CFS) to balance fairness and performance; and device drivers, which provide interfaces for hardware interaction ranging from storage to network peripherals.[16] The modular architecture is enabled through loadable kernel modules (LKMs), which are dynamically loadable components—typically device drivers, filesystem support, or system call extensions—that can be inserted or removed at runtime to adapt the kernel to specific hardware or functionality needs without rebooting. The kernel's development follows a decentralized, community-driven model coordinated primarily through the Linux Kernel Mailing List (LKML), where contributors worldwide submit patches, debate implementations, and review code.[17] Strict coding standards, enforced via tools like checkpatch.pl, ensure consistency and readability across the codebase. Despite these rigorous practices, the kernel faces persistent security challenges, with memory-related errors such as buffer overflows and use-after-free bugs, alongside concurrency issues like race conditions, accounting for around two-thirds of all historical vulnerabilities reported in Common Vulnerabilities and Exposures (CVEs).[2] By November 2025, the kernel exceeds 40 million lines of code, reflecting its vast scope and ongoing evolution, with stable releases occurring approximately every 9-10 weeks—the latest stable version being 6.17.8 as of November 2025, following the established cadence of major updates.[18]Development History
Project Initiation
The Rust for Linux project was kicked off in 2020 by Miguel Ojeda, a Linux kernel developer at Linaro, through initial experimentation and organization of efforts to integrate Rust into the kernel.[19] In July 2020, Ojeda contributed to early discussions on the Linux Kernel Mailing List (LKML) proposing in-tree Rust support for kernel modules, particularly drivers.[20] The project quickly gained backing from industry leaders including Google, Microsoft, and AWS, who recognized Rust's value in enhancing kernel security.[21][22] The primary motivations stemmed from the Linux kernel's vulnerability to memory safety issues inherent in C, which account for an estimated 60-70% of security bugs in C-based system software.[23] Rust was seen as an ideal solution to enable writing safer drivers and modules—especially those prone to concurrency and memory errors—while maintaining the performance and low-level control required for kernel code, without needing to rewrite the existing C codebase.[24] Early goals focused on prototyping Rust abstractions and bindings for core kernel APIs, such as those for memory allocation and I/O, while ensuring full ABI compatibility with C to allow seamless interoperation.[25] The first proof-of-concepts in 2020 centered on simple kernel modules, like basic character devices and network drivers, demonstrated through out-of-tree repositories that compiled Rust code against kernel headers using tools like bindgen for type-safe interfaces.[25][26] The project received its official reveal during a dedicated session at the Linux Plumbers Conference in August 2020, where developers discussed technical barriers and prototypes.[27] By the end of 2020, basic Rust support was available in out-of-tree kernel builds, enabling experimental module development.[25]Key Milestones and Releases
The Rust-for-Linux project began organized development in 2021 with the creation of its primary GitHub repository, where initial efforts focused on experimental components such as a Rust-based allocator and abstractions for task management to facilitate kernel integration. In September 2021, the inaugural Rust for Linux conference, known as Kangrejos, was held to discuss progress and future directions.[4][28] A pivotal advancement occurred in October 2022, when Linus Torvalds merged the initial Rust infrastructure into the Linux kernel tree for version 6.1, providing foundational support for compiling and loading out-of-tree Rust modules while establishing build tooling and basic APIs.[29] This merge, finalized on October 3, laid the groundwork for in-kernel Rust experimentation without altering core C codebases. Progress accelerated in 2023 and 2024, with Linux 6.8—released on March 10, 2024—introducing the first in-tree experimental Rust drivers, including a network PHY driver that demonstrated practical Rust usage in device handling.[30] Similarly, efforts on an NVMe host controller driver in Rust advanced as an experimental reference implementation, evaluating performance and safety in storage subsystems.[31] By Linux 6.15, released on May 25, 2025, the project achieved a "big victory" through expanded abstractions and the integration of substantial Rust drivers, such as the initial stub for the NVIDIA Nova GPU driver, enhancing graphics subsystem support.[32] In 2025, Rust integration deepened with later kernel versions, such as Linux 6.17 and beyond, incorporating Rust into core drivers, notably GPU components via the Asahi Linux project for Apple M1 series hardware, enabling native rendering acceleration.[33][34] An August 2025 project goals update from the Rust team emphasized stabilization efforts for unstable language features critical for kernel development.[35] By November 2025, the Linux 6.18 release candidate included additional hybrid C/Rust components, such as enhanced binder IPC and storage abstractions, reflecting broader adoption in inter-process communication and device management.[36] Key events in 2025 included the Kernel Recipes conference talk "A Rusty Odyssey," which outlined the timeline of Rust's evolution within the Direct Rendering Manager (DRM) subsystem, highlighting safety improvements in graphics drivers.[37] Contributions from organizations like Ferrous Systems, through expertise in embedded Rust safety, and the Rust Foundation, via funding and ecosystem alignment, have supported these advancements.Technical Foundations
Kernel Integration Architecture
The integration of Rust into the Linux kernel relies on a core architecture that enables Rust code to compile as loadable kernel modules (LKMs) while interfacing seamlessly with the existing C codebase. Bindings between C and Rust are generated using the bindgen tool, which processes C headers to create Rust-safe wrappers for kernel APIs, ensuring type-safe access to low-level structures and functions. The kernel provides dedicated Rust crates, such as those under thekernel namespace, offering abstractions that mirror C interfaces; for instance, the kernel::sync module wraps synchronization primitives like spinlocks and mutexes, allowing Rust developers to use familiar kernel semantics without direct unsafe C calls. This architecture maintains the kernel's modular design, where Rust components can be developed and maintained independently but interact via stable C exports.[38][39][40]
The build system for Rust kernel code is fully integrated into the kernel's Kbuild framework, treating Rust as a first-class language alongside C. Makefiles invoke the rustc compiler directly—bypassing Cargo—to compile Rust sources into object files, with support for Clang and LLVM as the preferred toolchain for optimal compatibility. Rust operates in a no_std environment, excluding the standard library to avoid dependencies on user-space features, and instead uses kernel-specific implementations for allocation and other basics, such as the rust_alloc crate for heap integration. Application Binary Interface (ABI) stability between Rust and C is achieved through extern "C" linkages, which define function signatures and data layouts compatible with the kernel's C ABI, preventing breakage during kernel updates. Configuration options like CONFIG_RUST enable this support, detected automatically if the toolchain meets requirements.[38][39][41]
Rust LKMs load and unload using the kernel's standard module system, coexisting with C modules without modifications to the core loader. Initialization and cleanup are handled via Rust equivalents of C's module_init and module_exit macros, which register entry points for module insertion and removal, ensuring proper resource management during runtime. For example, a Rust module might use these macros to set up abstractions for device drivers, integrating with the kernel's slab allocator or other subsystems upon loading. This approach preserves the kernel's hot-pluggable nature, allowing Rust modules to be dynamically inserted via tools like insmod or modprobe.[39]
The toolchain for Rust kernel development has evolved to prioritize stability and accessibility. Early efforts required nightly Rust for unstable features, but by 2025, the minimum stable version is 1.78.0 (released May 2024), with ongoing work to eliminate all nightly dependencies through stabilized alternatives. Features like pin_init—a library for safe, fallible initialization of pinned structures—are now supported via stable crates maintained by the Rust-for-Linux project. Prebuilt LLVM and Rust toolchains, including bindgen and libclang, are distributed from kernel.org to simplify setup across distributions, enabling builds with commands like make LLVM=1 rustavailable to verify compatibility.[41][42][38][43]
Memory and Concurrency Safety Features
Rust's memory safety model, enforced at compile time by the borrow checker, prevents common kernel vulnerabilities such as use-after-free and double-free errors by tracking ownership and lifetimes of references. In the Linux kernel context, this eliminates entire classes of memory bugs without introducing runtime checks, ensuring that invalid memory accesses are caught during compilation rather than execution. To handle kernel objects that must remain at fixed addresses, such as DMA buffers, Rust employs thePin abstraction, which guarantees that pinned data cannot be moved after initialization, preventing invalidation of hardware pointers.[44] This is particularly vital for device drivers, where direct memory access by peripherals requires stable memory locations, and Pin integrates seamlessly with kernel allocation APIs to maintain safety invariants.
For concurrency safety, Rust's Send and Sync traits ensure that data is only shared across threads in thread-safe manners, inherently preventing data races by restricting unsynchronized mutable access. In the kernel, these traits are leveraged through wrappers like Mutex<T>, which encapsulate C's raw_spinlock_t to provide safe, interrupt-context-compatible locking; only types implementing Sync can be protected by such mutexes, enforcing atomicity without race conditions.
Kernel-specific adaptations further enhance safety by using opaque types for C interop, such as wrapping bindings::task_struct in an Opaque struct to prevent direct, unsafe field access and force mediated interactions via safe APIs.[45] Additionally, error handling employs Result types for fallible operations like memory allocations, propagating errors explicitly and avoiding unchecked returns that could lead to null pointer dereferences in C code.
These features collectively address a significant portion of historical kernel vulnerabilities; for instance, according to a 2020 analysis, approximately 65% of CVEs in Ubuntu Linux kernel security updates were attributed to memory unsafety issues, many of which Rust's model mitigates at compile time with zero runtime overhead.[46]
Implementation and Usage
Developing Rust Kernel Modules
To develop Rust kernel modules, developers first need to set up the Linux kernel source tree. This involves cloning the official kernel repository using Git fromgit.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git. Once cloned, configure the kernel build by running [make menuconfig](/page/Menuconfig) and enabling the CONFIG_RUST option under the "General setup" submenu; this option only appears if a compatible Rust toolchain is detected, which can be verified beforehand with make LLVM=1 rustavailable. The build process requires a full LLVM toolchain (recommended over GCC, which is experimental), invoked via make LLVM=1 to compile Rust components alongside C code. For documentation, run make LLVM=1 rustdoc to generate HTML API docs from Rust source, viewable in the Documentation/output/rust/rustdoc/ directory.[38]
Testing Rust kernel modules typically leverages the KUnit unit-testing framework, adapted for Rust through macros like #[kunit_tests]. Enable CONFIG_KUNIT and CONFIG_RUST in the kernel configuration, then execute tests using the kunit.py script with options such as ./tools/testing/kunit/kunit.py run --make_options LLVM=1 --arch x86_64 --kconfig_add CONFIG_RUST=y; this builds and runs tests in an isolated environment. For broader integration testing, boot the kernel in QEMU or KVM emulators to load and verify modules dynamically, often using sample code from the samples/rust/ directory as a starting point. KUnit supports Rust's assert! and assert_eq! macros, along with the ? operator for error propagation, allowing tests to validate kernel APIs without full hardware. Additionally, kernel selftests in tools/testing/selftests/rust/ can be run with make TARGETS="rust" kselftest for runtime checks.[47][48]
In coding Rust kernel modules, the module! macro serves as the primary entry point declaration, encapsulating initialization and exit functions analogous to C's module_init and module_exit, while also handling module parameters and firmware dependencies. Kernel APIs are accessed through the kernel crate, providing wrappers like the pr_info! macro for logging informational messages at level 6, formatted similarly to Rust's print!. Errors are managed using core::result::Result types, with fallible operations propagating via the ? operator to ensure robust handling without panics, which are discouraged in kernel contexts. The Rust integration architecture exposes these APIs via bindings that allow seamless interaction with the C-based kernel core.[49][50][51]
Best practices emphasize maximizing safe Rust constructs to leverage memory and concurrency guarantees, reserving unsafe blocks solely for foreign function interface (FFI) interactions with C code; each such block must include a // SAFETY: comment justifying its soundness and preventing undefined behavior. Naming follows Rust idioms—snake_case for functions and variables, CamelCase for types—while adapting kernel-specific terms (e.g., GpioLine for GPIO lines) to align with existing APIs. Code should adhere to rustfmt defaults for formatting, including 4-space indentation and a 100-character line limit, with make LLVM=1 rustfmtcheck used during development to enforce consistency. Clippy lints can be enabled via CLIPPY=1 in the build to catch idiomatic issues early.[50][38]
Key tools for development include rust-analyzer for IDE integration, configured by running make LLVM=1 rust-analyzer to generate a rust-project.json file compatible with editors like VS Code or Vim. The standard cargo tool is not utilized, as the kernel's Kbuild system directly invokes rustc for compilation, cross-compiling the core library subset without the full Rust standard library. This setup ensures modules build as loadable kernel modules (LKMs) or built-ins, testable in isolation before upstream submission.[38][52]
Deployed Rust Components in the Kernel
The integration of Rust into the Linux kernel began with foundational components in early releases. Linux kernel version 6.1, released in December 2022, introduced initial Rust support, including a Rust-based allocator designed to provide memory allocation capabilities within the kernel's Rust ecosystem. This allocator serves as a core building block for Rust abstractions, enabling safe memory management for subsequent components. In kernel 6.2, sample drivers such as therust_pci stub were added, offering basic abstractions for PCI device handling to facilitate driver development and testing.
By 2025, more advanced Rust components have entered the mainline kernel, focusing on drivers for critical hardware interfaces. An experimental Rust implementation of an NVMe driver is under development, with recent rebases targeting kernel 6.15 as of mid-2025, focusing on safe queue management and interrupt handling for high-performance solid-state drives; it has not yet been merged into the mainline kernel.[31] In the graphics domain, Rust code has been integrated into the Direct Rendering Manager (DRM) subsystem, including utilities like the panic screen QR code generator, which encodes kernel crash information for easier debugging.[39] Representative examples include the first network PHY driver merged in kernel 6.8, which manages physical layer transceivers for Ethernet connections, and patches for an LED driver submitted in October 2025 for potential inclusion in kernel 6.18, controlling hardware indicators with minimal overhead.[53][54]
Ongoing efforts highlight Rust's application in GPU drivers. The Asahi GPU driver for Apple Silicon, developed as part of the Asahi Linux project, is written in Rust to interface with the kernel's DRM framework, enabling graphics acceleration on M-series chips; groundwork for mainline integration advanced during the development of kernel 6.17 in 2025.[33][34] Similarly, the Nova driver for NVIDIA GPUs represents an experimental successor to Nouveau, implemented in Rust to support GSP-based hardware with modular components for firmware loading and power management; core components have been merged into mainline as of November 2025, with further enablement patches targeting kernel 6.19.[55][56]
Rust components primarily target driver subsystems, such as network, storage, and GPU interfaces, where memory safety can mitigate common vulnerabilities. As of mid-2025, Rust accounts for a growing but small fraction of the kernel's codebase, with adoption accelerating for new drivers amid the overall 40 million lines of kernel source.[57][54] The Rust-based Binder driver, essential for Android's inter-process communication, was merged in October 2025, exemplifying vendor-specific extensions.[58]
These components are enabled through kernel configuration options prefixed with CONFIG_RUST, such as CONFIG_RUST=y for general support, which must be selected during compilation if a compatible Rust toolchain is available.[38] Out-of-tree Rust modules are prevalent among vendors; for instance, Google has incorporated Rust extensions in Android kernel variants to enhance security in device drivers.[58]
Adoption and Impact
Current Status in 2025
As of November 2025, Rust support remains integrated into the mainline Linux kernel starting from version 6.1, allowing developers to write kernel modules and abstractions in Rust alongside C code.[59] The Linux 6.18 release candidate incorporates a substantial volume of new Rust code, including enhancements to driver core frameworks for DebugFS, PCI support, and sysfs integration, as well as locking primitives like generic atomic variables to facilitate hybrid C/Rust shared memory models.[60] Official documentation for Rust kernel development is hosted at docs.kernel.org/rust/, providing guides on toolchain setup, coding guidelines, and API bindings.[1] Several major Linux distributions provide Rust toolchain support, enabling experimentation with Rust-based kernel modules. For instance, Ubuntu has supported Rust kernel module development since version 23.04.[61] Android's upcoming kernel integrations, starting with version 6.12 in late 2025, enable the first production Rust drivers for enhanced security in mobile environments, exemplified by Google's Rust implementation of the Binder IPC driver mainlined in kernel 6.18.[62][63] Project metrics indicate growing community engagement, with hundreds of contributions to Rust kernel code in the first half of 2025 alone, reflecting sustained developer interest despite ongoing debates.[64] Empirical analyses show that Rust code in the kernel reduces the incidence of memory safety bugs and data races compared to equivalent C implementations, contributing to overall stability in affected subsystems.[65] The Rust Foundation's 2025 updates highlight the Linux kernel initiative as a pivotal advancement in applying Rust to foundational systems software.[66] Vendor support continues to drive adoption, with Google actively contributing to Rust for Linux through its Android team, including the Binder driver and evaluations of additional components.[21] Microsoft is integrating Rust into Azure infrastructure, including components for cloud workloads.[67]Security and Performance Benefits
Rust's integration into the Linux kernel provides significant security advantages by leveraging its memory safety guarantees, which eliminate entire classes of vulnerabilities prevalent in C-based code, such as buffer overflows, use-after-free errors, and data races.[68] These protections stem from Rust's ownership model and borrow checker, enforced at compile time, preventing common memory-related bugs that account for a substantial portion of kernel vulnerabilities.[69] For instance, memory safety issues have historically comprised roughly two-thirds of past Linux kernel CVEs, and Rust-written components inherently mitigate this risk without relying on runtime checks or mitigations.[2] Empirical analyses of Rust kernel drivers confirm reduced incidence of memory safety bugs compared to equivalent C implementations, with case studies showing minimal use of unsafe Rust code (around 3%) and fewer overall errors.[69] In terms of performance, Rust maintains parity with C through zero-cost abstractions, compiling to efficient machine code without garbage collection overhead, making it suitable for kernel environments.[2] Benchmarks of Rust-based drivers, such as a native UDP implementation, reveal only marginal overhead—typically 0.7% to 3% in encapsulated scenarios—while delivering comparable throughput to C counterparts.[69] Rust's concurrency model further enhances efficiency in multi-core systems by enabling safe parallel execution without data races; prototypes in systems like Tock OS demonstrate reductions in interrupt handling latency by up to 3x using eBPF integration.[69] Beyond direct security and speed gains, Rust facilitates easier maintenance of kernel code by boosting maintainer confidence in refactoring and patch acceptance, leading to fewer regressions over time.[65] It also supports advanced formal verification tools, such as Prusti, which enable deductive proofs of correctness for safe Rust code, including kernel extensions, thereby strengthening overall reliability.[70] Studies from 2025, including those on framekernel architectures like Asterinas, affirm these benefits by demonstrating a sound, minimized trusted computing base (about 14% of the codebase) with performance on par with Linux, underscoring Rust's role in enhancing kernel safety without compromising efficiency.[71]Challenges and Future Directions
Technical and Toolchain Hurdles
The integration of Rust into the Linux kernel relies on the nightly channel of the Rust compiler due to dependencies on several unstable features, which introduces risks of breakage from frequent changes. For instance, features such asarbitrary_self_types and derive_coerce_pointee remain unstable as of November 2025, with ongoing efforts to stabilize them.[72] Full elimination of such dependencies is a priority but unlikely in the short term.[73] This reliance on nightly builds complicates long-term maintenance and stability for kernel developers, as updates can alter behavior without notice.[72]
Interfacing Rust code with the existing C-based kernel necessitates the use of unsafe blocks, particularly for foreign function interface (FFI) calls and low-level operations, which comprise a notable portion of Rust kernel modules. An empirical analysis of upstream Rust-for-Linux drivers reveals that unsafe code appears commonly across major components, often unavoidable for C interoperability, though proper encapsulation can preserve overall safety guarantees. For example, in analyzed drivers like GPU (107 instances) and NVMe (44 instances), many unsafe uses stem from missing abstractions.[6] Additionally, the kernel's real-time constraints pose challenges, as Rust's no_std environment lacks comprehensive ecosystem support for certain utilities, with approximately 6,408 crates fully compatible as of a 2023 study, and conversion from std-dependent code requiring significant refactoring.[74] These gaps limit the availability of safe abstractions for time-sensitive operations.
Rust kernel development also encounters performance hurdles in the build process, with compile times generally longer than equivalent C code due to the language's complex type system and monomorphization.[75] Debugging remains more cumbersome without mature toolchain integration; full GDB support for Rust kernel modules has improved in 2025 but still lags behind C, requiring specialized scripts or tools for effective tracing.[2]
As of 2025, certified toolchains like Ferrocene—a qualified Rust distribution for safety-critical systems—have been tested for building the Linux kernel, achieving qualifications such as IEC 62304 Class C for medical devices and supporting no_std environments.[76] However, ongoing stability concerns with unstable features and toolchain evolution continue to restrict Rust's adoption to peripheral drivers rather than core subsystems.[77]