For over three decades, Linux has been written in the C programming language. Indeed, Linux is C’s most outstanding accomplishment. But the last few years have seen a growing momentum to make the Rust programming language Linux’s second Linux language. At the recent Open Source Summit in Austin, Texas, Linux creator Linus Torvald said he could see Rust making it into the Linux kernel as soon as the next major release.
After the conference, I spoke with Torvalds and he said, “I’d like to see the Rust infrastructure merging to be started in the next release, but we’ll see.” The next Linux release would be Linux 5.20. Torvalds and the other Linux kernel maintainers are currently working on Linux 5.19.
The average time between new mainline kernel releases is 9 to 10 weeks. That means we’ll probably see 5.19 in early August. Then, if all goes well, we’d see Rust in 5.20 in late October or early November 2022.
But, Torvalds added, “I won’t force it, and it’s not like it’s going to be doing anything really meaningful at that point — it would basically be the starting point. So, no promises.”
Now, you may ask: “Why are they adding Rust at all?”
Rust lends itself more easily to writing secure software. Samartha Chandrashekar, an AWS product manager, said it “helps ensure thread safety and prevent memory-related errors, such as buffer overflows that can lead to security vulnerabilities.” Many other developers agree with Chandrashekar.
Torvalds also agrees and likes that Rust is more memory-safe. “There are real technical reasons like memory safety and why Rust is good to get in the kernel.”
Mind you, no one is going to be rewriting the entire 30 or so million lines of the Linux kernel into Rust. As Linux developer Nelson Elhage said in his summary of the 2020 Linux Plumber’s meeting on Rust in Linux: “They’re proposing a rewrite of the Linux kernel into Rust; they are focused only on moving toward a world where new code may be written in Rust.” The three areas of potential concern for Rust support are making use of the existing APIs in the kernel, architecture support, and dealing with application binary interface (ABI) compatibility between Rust and C.
So, if everything works out, you can expect to see some memory-safe Rust in the Linux kernel later this year. After that, it will start appearing in mainstream Linux distros such as Debian, Ubuntu, SUSE Linux Enterprise Server, and Red Hat Enterprise Linux by 2023.