Linux Developers Continue Evaluating The Path To Adding Rust Code To The Kernel
As mentioned back in July, upstream Linux developers have been working to figure out a path for adding Rust code to the Linux kernel. That topic is now being further explored at this week's virtual Linux Plumbers Conference and it's still looking like it will happen, it's just a matter of when the initial infrastructure will be in place and how slowly the rollout will be.
Back in July, Linus Torvalds shared his thoughts on Rust within the Linux kernel tree and didn't shoot down the idea just his preference on how it be handled, basically having it be enabled if Rust is present on the system.
To be clear though, these Rust Linux kernel plans do not involve rewriting large parts of the kernel in Rust (at least for the foreseeable future...), there would be caveats on the extent to which Rust code could be used and what functionality, and the Rust support would be optional when building the Linux kernel. C would remain the dominant language of the kernel and then it's just a matter of what new functionality gets added around Rust if concerned by memory safety, concurrency, and other areas where Rust is popular with developers.
Various upstream developers have been interested in Rust for those language benefits around memory safety and security as well as its syntax being close to C. There would be a to-be-determined subset of Rust to be supported by the Linux kernel.
Besides figuring out the limits of the Rust support within the kernel, also being figured out is the Kbuild/Kconfig build integration, whether to make use of Rust's Cargo as a builder, and other guidelines such as ensuring all the Rust code remains in-tree (not using Cargo to fetch external code).
While the Rust code would be optional, the developers do acknowledge there are limitations on where Rust is supported due to the LLVM compiler back-ends. But at least for x86/x86_64, ARM/ARM64, POWER, and other prominent targets there is support along with the likes of RISC-V.
Nothing firm has been determined yet but it's a topic that is still being discussed at the virtual LPC this week and surely over the weeks/months ahead on the kernel mailing list. There is Rust-For-Linux on GitHub with a prototype kernel module implementation. There is also the PDF slides from today's talk on the matter.