At the ongoing Maintainers Summit conference, the results of an experiment to add the ability to develop components in the Linux kernel using the Rust language were discussed. The participants recognized the experiment as successful and decided to transition Rust language support to the category of core kernel components, removing its experimental functionality label.
Three years ago, the ability to develop drivers and modules in Rust was added to version 6.1 of the kernel. Since then, abstractions for developing Rust drivers for GPUs, file systems, block devices, network adapters, and USB devices have been included in the kernel. The Nova driver for NVIDIA GPUs, asahi for Apple AGX GPUs, Tyr for ARM Mali GPUs, and rust_ext2 for the Ext2 file system are being developed in Rust. A Rust implementation of IPC Binder has been accepted into the kernel. The RROS project develops a real-time subsystem for the Linux kernel, written in Rust. Rust support is inactive by default and does not make Rust a mandatory build dependency for the kernel.
Proponents of promoting Rust believe that the language eliminates the majority of errors found in the kernel, often caused by the peculiarities of the C language (corner cases), allowing reviewers to focus on logical errors and race conditions. Rust helps avoid issues like accessing memory after it has been freed, buffer overflows, improper resource release during error handling, and missed checks for returned error codes. Using Rust for new code also allows for shorter development times due to reduced debugging costs and strict guarantees in the language that detect errors early in the coding process.
Opponents of introducing Rust into the kernel consider the use of multiple programming languages in complex projects unacceptable — mixed codebases complicate maintainers' work, putting them at the mercy of code in another language. For example, with bindings in Rust, developers of subsystems written in C must take into account the impact of changes on the continued operability of these bindings.
Source: opennet.ru
