Rust on Linux: advances, challenges and current status

Rust drivers on Linux

Since Linus Torvalds included Rust in Linux Kernel version 6.1, the language has been gradually gaining ground and more and more developers are joining this movement.

However, some of the developers of the linux kernel They highlight that advances will increasingly mean more work and challenges, since within their comments they imply that a stalemate may arise.

It is worth clarifying that we are not mentioning that the implementation reaches a dead end, but rather given the comments of various developers and as we already mentioned, in the current state, the need to reduce the pace of work has begun to emerge, or at least that is what the following article suggests to us LWN.net.

And several weeks ago I came across this article which addresses the current state of the use of Rust in Linux and analyzes whether the experiment with this programming language has been successful.

It is mentioned that for some years, Rust has been a topic that has not stopped being discussed at the "Kernel Maintainers Summit" and the one held in 2023 was no exception, since since the official implementation of Rust as a second programming language in Linux, Miguel Ojeda, Rust-for-Linux developer, highlighted the growing interest in the use of Rust for kernel development during the session dedicated to this topic.

Miguel Ojeda mentions that the project Rust-for-Linux has experienced significant momentum in the last year, since a full-time engineer and a student developer have joined and various companies have joined in supporting the work. Additionally, work is underway to integrate the Coccinelle tool with the Rust code. However, not everything is rosy, since one of the current challenges is recruiting more reviewers for the code that is being developed.

Linux Kernel
Related article:
Linux 6.1 arrives with Rust, performance improvements, drivers and more

In the articleand mentions that the problems have begun to be noticeable in the tool chain, since compiler progress GCC-based Rust, known as gccrs, has slowed down. On the other hand, the GCC code generator for rustc shows promising progress and has been merged with the compiler, which will allow Rust support to be expanded to architectures that are not compatible with LLVM.

Related article:
In GCC they approved the implementation of RUST (gccrs)

Inside the kernel, progress is being made in several subsystems, such is the case of the Rust implementation of android binder which has demonstrated comparable performance to the C implementation, with a minimal amount of unsafe code. Additionally, work is being done on filesystem linking with the goal of achieving read-only support in Rust, with the vision of implementing a completely secure filesystem in Rust.

Dave Airlie, the maintainer of the DRM (graphics) subsystem, said that if he has his way, there will be a merged Rust DRM driver in upcoming releases. Christoph Hellwig responded that Airlie was willing to "make everyone's lives hell" so she could play with his favorite toy. Hellwig said merging Rust would force others to deal with a second language, new toolchains, and "wrappers with strange semantics." Dan Williams said that the current situation "is what success looks like" and that the kernel community was already committed to Rust.

Although there is growing interest among maintainers in adopting Rust, challenges arise, since it has been debated need to have kernel reference drivers written in Rust to show how controllers can be written in this language. However, the duplication of functionality between drivers in Rust and C has generated distrust among maintainers.

The discussion about the inclusion of Rust has taken different directions, Well, some maintainers advocate merging standalone Rust drivers, such as the binder driver, to demonstrate their viability, while on the other side of the coin others They express concerns about the complexity of maintaining a kernel with two programming languages.

Airlie went on to say that much of Rust's work is currently locked in a bit of a chicken and egg problem. Abstractions cannot be merged until there is a user for them, but code that needs those abstractions is blocked waiting for the code to reach multiple subsystems. As a result, developers working on Rust are carrying large amounts of patches they need to make their code work. Breaking that obstacle will require allowing the entry of some abstractions without immediate users.

Despite the challenges, kernel community recognizes Rust's potential to improve code security and stability. There is the possibility of merging more widely used drivers into Rust in the future, once concerns about patchability and maintainability are resolved.

Ojeda agreed that this issue has slowed progress, but said he has tried not to pressure maintainers to merge code quickly. In the case of networking, ironically, the Rust developers had to ask the network people to slow down the merging of the Rust code.

Finally, it is worth mentioning that the path to widespread adoption of Rust on Linux presents challenges, the interest and progress in this space is evident. Over time, Rust is expected to play an important role in improving Linux.

Source: https://lwn.net/


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  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.