OUR EXPERT
Nate Drake considers himself a Rust programming expert. Or did he say he’s rusty at programming…?
Rust is in the kernel. Since the 2020 Linux Plumbers conference, developers have been R mulling the subject over. With Linus Torvalds’s blessing and after a flurry of pull requests, it’s now possible to write kernel modules like device drivers and filesystems entirely in Rust.
Three years later, and there’s been major progress with the support of big players like Samsung, Cisco and Canonical. You can follow recent developments at the Rust for Linux project (https://rust-for-linux.com).
As Alex Gaynor and Geoffrey Thomas explained at the 2019 Linux Security Summit, almost two thirds of Linux kernel security holes come from memory safety issues. With all due deference to the old vanguard of C coders, these issues are mostly caused by inherent weaknesses in C and C++. Rust can avoid these problems altogether by using APIs.
This isn’t to say that it’s time to forget C altogether, but major versions of Linux are already taking their first tentative rusty steps. For instance, Ubuntu has made it easier to use Rust for kernel programming by providing all the necessary toolchain and kernel requirements to build and test out-of-tree kernel modules. This can be done without changing the Ubuntu source code. Developers can even share modules with other Ubuntu users without special toolchain/kernel requirements.
While the future is reassuringly rusty, various issues, such as duplicate drivers and backporting Rust support to LTS releases of versions of Linux, mean we’re probably some years away from a fully-fledged major Linux distro coded entirely in the language.
For French software engineer Luc Lenôtre, this was clearly too long to wait. This was why, as he states on his GitHub page (https://github.com/llenotre), he decided to create his own “Unix-like operating system from scratch using the Rust language, just for fun.”
Like many great inventions, Maestro has taken some time to get off the ground. In his blog, (https://blog.lenot.re) Luc modestly admits that the first commit of the kernel took place in 2018, but at the time it was written entirely in C.