The father of Linux speaks: Rust is coming to the Linux kernel

Author | Yu Ying, Dongmei

Linus Torvalds: Rust For The Kernel

May be merged into Linux 5.20

Speaking at the Linux Foundation Open Source Summit this morning, Linus Torvalds said Rust could be in the Linux kernel soon, as soon as the next kernel cycle.

Linus Torvalds and Dirk Hohndel’s regular talk/conversation at the Open Source Summit, Linus commented on the Rust programming language code in the kernel.

Torvalds said they hope to incorporate code written in Rust into the kernel soon, and even Rust may appear in the next release, Linux 5.20.

Currently, no Rust for Linux pull requests have been sent or merged, but the kernel’s Rust startup code has started to stabilize when used in infrastructure, some basic example drivers.

Last month saw the latest release of Rust Linux kernel patches bring more features into shape, in addition to completing the review. As mentioned many times before, Rust support in the Linux kernel is still optional at build time, depending on whether you need support or just implement certain kernel features in Rust code.

The Linux 5.20 merge window will open around the end of July after the Linux 5.19 stable release, and by then we’ll know if a Rust PR has been committed and logged into the next kernel release. It shouldn’t surprise anyone how things went next, as Linus had already sent his blessings.

Liunx 5.20 already has some notable performance optimizations, including new hardware support, more AMD support work, RDNA3 is expected to be in good shape in this version of the kernel, we may also see MGLRU mainline and some other expected Function.

Back in late 2021, Miguel Ojeda, lead developer of the Linux kernel and Rust on Linux, submitted a new patch (v2) to the Linux Kernel mailing list, advancing the work on Rust for Linux.

The content of the email states that the new patch will add support for Rust as a second language to the Linux kernel and make several improvements to Rust’s overall support. Specifically, Rust code now relies on the stable Rust compiler rather than the previous beta state. Every time a new stable Rust compiler is released in the future, Rust on Linux will be migrated, Ojeda said.

Looking ahead, Ojeda goes on to mention that “By upgrading the compiler, we have been able to remove some of the unstable features we use from the list. We will continue to upgrade until we no longer depend on any unstable features, at which point, We may start announcing support for minimum versions of Rust, as we did with GCC and Clang.”

It now appears that Ojeda’s idea is not far from becoming a reality.

Support from academia and industry

With the rise of Rust, many developers are increasingly interested in trying Rust in the Linux kernel.

In 2019, Alex Gaynor and Geoffrey Thomas presented at the Linux Security Summit, where they presented a prototype of the Rust kernel module and made a case for adopting Rust in the kernel. The talk focused on security issues, pointing out that in Android and Ubuntu, about two-thirds of the kernel vulnerabilities are assigned to CVEs, and these vulnerabilities come from memory safety issues. In principle, Rust can completely avoid these kinds of errors with the safer API provided by its type system and borrow checker.

At the 2020 Linux Plumbers Conference, Thomas, Gaynor, Rust language team co-leader Josh Triplett, and a few other interested developers discussed bringing Rust to the There are some issues that still need to be resolved in the Linux kernel project as an optional development language. where in-tree is a Linux term, meaning that the kernel modules are stored with and built with the kernel source tree itself.

Attendees emphasized that they are not proposing to rewrite the Linux kernel into Rust, but are just focused on moving towards a world where new code can be written in Rust. This discussion focuses on three potential concerns supported by Rust:

  • Binding to existing C APIs;

  • Architecture support;

  • About ABI compatibility with the kernel between Rust and C. In this regard, Linus Torvalds, the father of Linux, also expressed his opinion: Linux will not be written in Rust in the end, and no one will use Rust to rewrite the 25 million lines of the kernel, but he also saw the advantages of Rust and encouraged the adoption of slow but stable Approach brings Rust to Linux, while he says it makes sense to use the Rust interface for drivers and other non-core kernel programs.

In addition, Ojeda also revealed in the email that after ARM, Google and Microsoft, Red Hat also expressed their intention to support the project.

About the Rust Foundation

In February last year, the Rust Foundation was officially announced.

The Rust Foundation is a new independent non-profit organization that manages the Rust programming language and ecosystem. The organization will work to support those maintainers who manage and develop the project.

The Rust Foundation was jointly established by AWS, Huawei, Google, Microsoft, and Mozilla, and has committed to investing a budget of $1 million over two years for the development, maintenance, and promotion of Rust projects.

Ashley Williams, interim executive director of the Rust Foundation and core team member, said at the time, “This marks a big step forward for Rust in many dimensions, and more importantly, some of the world’s leading companies in the industry have made formal financial Prediction: Rust will be an indispensable technology in future enterprise production.”

The text and pictures in this article are from AI Frontline

loading.gif

This article is reprinted from https://www.techug.com/post/the-father-of-linux-said-rust-is-about-to-appear-in-the-linux-kernelf31dc4f3e9de8a94fc68/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment