Rust, something Linux developers seem to agree with

The programming language Rust has always aimed to replace C in Linux kernel development And it is that as Rust has matured, several developers have expressed a growing interest in its use in the Linux kernel.

In the Virtual Conference of Linux Plumbers 2020, the microconferencing flow by LLVM organized a session on open questions and barriers for upstream acceptance of Rust on the Linux kernel.

Interest in this topic is visible, as this session was the busiest of the 2020 event.

So should we now rewrite the entire Linux kernel with the Rust language? This discussion does not date from today and has been accentuated since the appearance of the first stable version of Rust in 2015.

In view of the possibilities it offers Rust, some suggest doing it. This year, at the Linux Plumbers conference in August, the speakers had time again to discuss it.

And the surprising thing is that they seem to agree unanimously no not to rewrite the existing code in Rust, but for kernel development to continue using Rust. That is, they envision a world in which new pieces of code could be written in Rust.

This session built on the previous work of many developers, including a talk given last year by Alex Gaynor and Geoffrey Thomas at the Linux Security Summit.

At the conference, they presented their work on prototyping Rust kernel modules and advocated for the adoption of Rust in the kernel.

They cited work showing that roughly two-thirds of the kernel vulnerabilities assigned CVE in Android and Ubuntu are related to memory security issues.

They ended up explaining that Rust can completely avoid this kind of error thanks to more secure APIs enabled by your system type and your loan verifier.

This study managed to convince several maintainers already Linus Torvalds, who supported the introduction of Rust into the kernel. Thomas and Gaynor, Josh Triplett, co-chair of the Rust language team and longtime Linux kernel developer, as well as other interested developers participated in the discussion on the topic.

They briefly touched on his work so far and some of his first thoughts and questions before opening most of the time for discussion.

These are the use of existing APIs in the kernel, architecture support, and a question about ABI compatibility between Rust and C.

In fact, they initially believe that introducing Rust into the tree structure must respect the existing C APIs. 

However, everyone feels the devil is in the details, and both the work done so far and the conversation during the session have revealed some open challenges.

For example, Linux makes heavy use of preprocessor macros and inline functions, which are not as easily supported by the bindgen tool and Rust's external functions interface.

According to them, currently the only mature implementation of Rust is the compiler rustc, which issues code through LLVM.

The Linux kernel supports a wide variety of architectures, many of which do not have an LLVM backend available.

For his part, Triplett suggested that adding Rust to the kernel would help increase architectural support for Rust, citing his experience with the Debian project. He mentioned that the introduction of Rust software in Debian has helped motivate enthusiasts and users of niche architectures to improve Rust support, and he hopes to add kernel support to have a similar effect.

In particular, he was convinced that any architecture with an LLVM backend would quickly be compatible with Rust. The discussion also focused on alternative Rust implementations as a path to broader architecture support.

The session ended with no further specific milestones, but there seems to be overall enthusiasm for supporting Rust Mods and growing agreement on the general requirements for this support.


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

A comment, leave yours

Leave a Comment

Your email address will not be published.

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Autopilot said

    It seems the beginning of a new era, the immovable C comes up.

    Hello Rust, Bye Linus Torvalds!