The Rust programming language will join the Linux kernel

Alfonso Maruccia

Posts: 88   +41
Staff
What just happened? Rust will soon be part of Linux, Torvalds has decided. The memory safe programming language will join C and the other traditional languages developers use to create new pieces and drivers of the ubiquitous open source kernel.

The debate around the inclusion of Rust in Linux has seemingly ended: Linus Torvalds, the original creator and current maintainer of the open source kernel, has decided that, "unless something odd happens," Rust will be part of the final Linux 6.1 release.

Rust is a modern, general-purpose programming language designed by Graydon Hoare while working at Mozilla, the first company to officially sponsor and to adopt it for the experimental browser engine Servo.

Like many other compiled languages, Rust can offer native performance while powering different types of applications – from traditional computing to low-resources devices and embedded appliances. Performance aside, Rust is designed to provide memory safety from the get go eliminating many classes of bugs and potential vulnerabilities at compile time.

The first version of Rust was released 12 years ago, while including the language in the Linux kernel has been in discussion for quite some time. Google, one of the founding members of the Rust Foundation together with AWS, Huawei, Microsoft and Mozilla, actively uses Rust to develop Android -- the mobile operating system is built upon a modified version of Linux.

After announcing support for Rust in Android, the Android Team began pushing for the language to be included in the kernel as well. In 2021, team member Almeida Filho wrote that Rust was "ready to join C as a practical language for implementing the kernel." The new language can help reduce the number of potential bugs and security vulnerabilities in privileged code, Filho said, while playing nicely with the core kernel and preserving its performance characteristics.

There were concerns among top Linux contributors about non-standard extensions needed by Rust to work with the kernel, but according to Torvalds, programmers have been using exceptions to the standard C language for "decades."

Torvalds added that there are still some issues with compilers, but because Rust is well supported in the Clang frontend, merging the programming language will probably help and not hurt the kernel. In the first release, Torvalds warned, Rust will just have the core infrastructure with no "serious use case" to show yet. Nonetheless, kernel merging should mark a first important step in the Linux + Rust future.

Permalink to story.

 

fps4ever

Posts: 1,101   +1,791
I don't know much about the Rust language from the little I read but this seems like a great idea security wise. Fast(er) and secure is always good. I know Linus has been mulling it over for quite a while.
 

Revolution 11

Posts: 235   +329
I don't know much about the Rust language from the little I read but this seems like a great idea security wise. Fast(er) and secure is always good. I know Linus has been mulling it over for quite a while.
It's not any faster than C++, which is the gold standard for a very fast and efficient language. In fact, Rust will usually be slower, all other things being equivalent. For performance-sensitive applications, C++ is still the top choice.

But it is a lot easier to write memory-safe code which will remove a lot of bugs and speed up programming workflows.
 

dangh

Posts: 786   +1,331
It's not any faster than C++, which is the gold standard for a very fast and efficient language. In fact, Rust will usually be slower, all other things being equivalent. For performance-sensitive applications, C++ is still the top choice.

But it is a lot easier to write memory-safe code which will remove a lot of bugs and speed up programming workflows.
From what I was getting here, performance of Rust and C(++) is quite similar. Some operations are faster on Rust, some are faster on C (https://levelup.gitconnected.com/wh...ts-find-out-who-is-the-usain-bolt-87495c774c8 or https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/rust-gpp.html)
So, performance - wise it is quite the same. But it is easier to write well performing code on Rust.
Rust have advantage in security. C(++) have advantage in many decades of tools and materials.
I think Rust is really good choice and well prepared successor of C, and Linus surely thinks the same, otherwise there wouldn't be kernel integration.
 

Revolution 11

Posts: 235   +329
From what I was getting here, performance of Rust and C(++) is quite similar. Some operations are faster on Rust, some are faster on C (https://levelup.gitconnected.com/wh...ts-find-out-who-is-the-usain-bolt-87495c774c8 or https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/rust-gpp.html)
So, performance - wise it is quite the same. But it is easier to write well performing code on Rust.
Rust have advantage in security. C(++) have advantage in many decades of tools and materials.
I think Rust is really good choice and well prepared successor of C, and Linus surely thinks the same, otherwise there wouldn't be kernel integration.
Hmm, Rust has improved more than I thought when I last checked on it. Thanks for the information.