Initial Support For The Rust Language Lands In Linux-Next

Written by Michael Larabel in Linux Kernel on 19 March 2021 at 12:40 PM EDT. 63 Comments
LINUX KERNEL
For a long while now Linux kernel developers have discusses the prospects of optionally allowing the Rust language to be used for new device drivers within the Linux kernel areas and other areas within the kernel for this language that prides itself on safety and performance. As the first baby step towards that dream, initial Rust support appeared this week in the Linux-Next tree.

Announced yesterday on rust-for-linux was word of initial Rust support hitting Linux-Next. Miguel Ojeda who has been involved with this effort was quick to note in the announcement, "This does not mean we will make it into mainline, of course, but it is a nice step to make things as smooth as possible. Stephen has kindly agreed to give me a bit of leeway the first few days until the RFC to rebase things as needed, which is very much appreciated."

The code merged lays the foundation for building Rust kernel features moving forward. The initial infrastructure is in place and all of the new code residing under rust/.

This support is obviously conditional upon a Rust compiler (rustc) being present on the system. As such the current architectures focused on are ARM64 and x86_64. Currently the kernel support needs a recent nightly Rust toolchain for building.

While no fully-baked Rust kernel driver is ready yet, the initial merge to Linux-Next does include an example kernel module written in Rust. See the merge link above for more details.

Particularly over the past year excitement around possibly introducing optional Rust support in the kernel heated up. There's been much to figure out about allowing Rust in the kernel but last summer at least Linus Torvalds indicated he would be open to Rust in the kernel.

While Rust is now in Linux-Next, it's not yet clear if/when it will be mainlined. Generally work in Linux-Next bakes until the next cycle but sometimes can stay in Linux-Next longer if it's still a work-in-progress. The code still needs to go through all the merge window pull request formalities and we haven't seen Linus Torvalds provide any fresh take on these Rust efforts. In any case, the effort is moving along and will be interesting to see if this initial Rust infrastructure for the Linux kernel does manage to make it mainline for 5.13 or another kernel release this year.
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