First review the news about the Linux kernel supporting Rust.
- In 2019, the kernel maintainer Greg says yesacceptDevelop drivers for the Linux kernel in Rust.
- In 2020,Linus Torvalds responded to his personal opinion on the support of Rust in the Linux kernel. Instead of rejecting the proposal, he advocates turning the feature on by default to ensure that the feature is adequately tested. Of course this feature is best implemented in an adaptive way, if a Rust compiler is detected on the system, Kconfig will enable Rust support and continue to build any putative Rust kernel code to at least see if it builds correctly.
- At the 2020 LPC (Linux Plumbers Conference) conference, the kernel developers basically reached a consensus that they do not plan to rewrite the existing kernel in Rust, but only focus on new code that can be written in Rust. Specifically, they focused on three possible aspects of the Linux kernel’s support for Rust: existing APIs in the kernel, architectural support, and ABI compatibility issues with the kernel.
- In 2021, Google says AOSP (Android Open Source Project) now supports the use of Rust to develop the Android operating system (Android is also a Linux distribution).
- In 2021, Linus once again expressed his views on the support of Rust in the Linux kernel, he is wait-and-see and open to this, and said that the first goal of Rust should be drivers.
Google uses Rust to develop Android mainly to solve memory safety issues. Its engineers believe that Rust can use compile-time checks (to ensure the life cycle and ownership of objects) and runtime checks (to ensure that memory access is valid) to ensure memory safety, and Rust is in the implementation. This safety is combined with performance comparable to C and C++. Google’s addition of a new development language to Android didn’t involve legacy code, mostly for new development — to avoid new memory safety bugs. This is basically the same as the implementation idea of the Linux kernel supporting Rust.
At LPC 2022, Linus talked about Rust again. He expected to see Rust merged into the kernel in version 6.0, but it didn’t happen. So he wouldn’t claim to be able to achieve this goal in version 6.1.
Also at this conference, Andreas Hindborg, a Linux kernel engineer at Western Digital, presented an NVMe driver written in Rust, and the benchmark results showed that the Rust NVMe driver, although still in its early stages, has performed well – The Rust driver is able to achieve comparable performance to the C driver. Linux Kernel developers think Rust on Linux is in a ready state.
At the 2022 Linux Kernel Maintainers Summit, just after the LPC conference, Linus proposedMerged Rust support into Linux 6.1. One reason he said he would like to see Rust in the kernel is to encourage new developers to work on the kernel.
There are two main reasons why Rust has not fully entered the kernel before, one of which is the processing of non-standard Rust extensions, and the other more important reason is that the Rust compiler is not yet stable. Linus said he was more concerned about the latter reason, because The reliability and stability of the Rust compiler is more important.
As reported by ZDNet, Linus replied to reporters in an email interview that, barring an accident, support for Rust will be merged into Linux 6.1.At the same time, he reminded“Rust is only used in core infrastructure”. Regardless, this is an important first step for both Rust and Linux.
#Linus #Torvalds #Rust #merged #Linux #mainline