Latest Patches Sent Out For Adding Rust Support To The Linux Kernel

Written by Michael Larabel in Programming on 4 July 2021 at 05:33 PM EDT. 72 Comments
PROGRAMMING
This US Independence Day a revised set of patches were mailed out providing support for Rust as a secondary programming language within the Linux kernel for areas where increased security and memory safety are of utmost importance. The set of 17 patches plumb the Linux kernel with initial support, an example driver, and in total amount to more than 33k lines of new code in its early form.

Miguel Ojeda who has been leading the "Rust for Linux" effort - and now funded by Google for this project - to allow this programming language to be used in the kernel sent out these patches. While the 5.14 kernel merge window is happening at the moment, this wasn't labeled as a pull request and will presumably not land until a later cycle. This succeeds the "request for comments" patches sent out in April.

Part of the reason why the Rust for Linux enablement is now up to 33k+ lines of code is they for now are including a subset of Rust's "alloc" standard library in the tree as they adapt changes for kernel purposes. Eventually they will try to get their changes upstreamed into the alloc crate but for now are carrying this within the kernel tree. Other needed crates are also carried within the kernel tree.

Another change with these new patches is that prior rounds required using nightly releases of the Rust compiler while now the kernel can be compiled with beta and stable rustc releases. However, the kernel support does require some Rust compiler features currently treates as unstable by upstream.

In addition to AArch64, PowerPC, and x86_64, ARM 32-bit and RISC-V are also now supported by this Rust for Linux enablement.

In addition to the plumbing for Rust in the Linux kernel, an initial user of the Rust support is an Android Binder IPC implementation in Rust that is still considered a work-in-progress.

These latest Rust for Linux kernel patches can be found on the kernel mailing list.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week