Rust for Linux includes several enhancements to support

During the last months Linux developers have been arguing the possibility of allow the use of the Rust language to write new device drivers for the kernel.

Last year, the Linux kernel developers they seem to have reached an agreement on the matter, Rust supporters have cited work showing that roughly two-thirds of kernel vulnerabilities assigned CVEs in Android and Ubuntu are related to memory security issues.

Following this statement, Linus Torvalds, software engineer, lead creator, and developer of the Linux kernel, said in an interview that discussions on the topic would be far more important than a lengthy Google post on the language.

When asked about the suggestion to use Rust, he indicated that, "The solution here is simple: just use C ++ instead of Rust."

After that in March, the first support was launchede which allowed the Rust drivers to be placed in the Linux-Next tree for further testing before their eventual inclusion in the main kernel.

Right behind it was a "request for comment" reissued on the kernel mailing list about the Rust code perspective for the Linux kernel.

Miguel OjedaLinux kernel developer started a Request for Comments (RFC) proposal on the Linux kernel mailing list.

The mailing list post outlined the beliefs of developers involved in adding Rust code to the kernel, benefits like improved memory security, and more.

“Some of you have noticed in recent weeks and months that a serious attempt is being made to bring a second language to the kernel. We are finally there, with an RFC that adds Rust support to the Linux kernel, ”said Miguel Ojeja. "We know that there are enormous costs and risks involved in introducing a new language to the kernel," he added.

The Rust for Linux Project Team moved from the Rust beta compiler to using stable releases, migrating every time a new version is released.

"We would like to thank Rust for working with us on these options so that the kernel can use them," said Miguel.

When updating the compiler, the team was able to remove some unstable features from the list: const_fn_transmute, const_panic, const_unreachable_unchecked, core_panic, and try_reserve.

In addition to this, it is highlighted that some modularization options have been added more to alloc to disable some unnecessary functions: no_rc and no_sync.

Upstream, in order for the kernel use case to be well supported, or more precisely the "mix" of options the kernel needs, Upstream core has also added no_fp_fmt_parse.

On the other hand, Rust enabled a series of additional diagnostics for the Rust and Clippy compiler. One difference from C is that Rust diagnostics are a bit easier to disable in code, which is stricter in the general case.

As well abstractions and driver updates have been implemented. The team added abstractions for stream locks, power management callbacks, io memory (readX / writeX), irq chips and high-level stream managers, gpio chips (including irq chips), peripherals, amba peripherals, and drivers.

The support of the controller is enhanced with a bus independent infrastructure, Revocable objects, revocable mutexes, efficient bit iterators, better panic diagnostics, and simplified pointer wrappers. Additionally, it improved and simplified Ref objects (compatible with refcount_t) and replaced all Rust instances.

And a new driver for gpio PL061 devices has been implemented and shipped as RFC patch.

Finally it should be noted that Rust support is still considered experimental. However, the support is good enough that kernel developers are getting to work in Rust abstractions for write subsystems and controllers and other modules. The current series has just arrived on Linux-next, so the first run will take place this week.


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

Be the first to comment

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.