The third version of the patches for Rust driver support in Linux has already been released

Six months after the publication of the second version, Miguel Ojeda, author of the Rust-for-Linux project, made known the proposal of the third option for the development of device drivers in Rust language in the Linux Kernel.

Rust support is considered experimental, but its inclusion in the linux-next branch has already been agreed. The development is funded by Google and the ISRG (Internet Security Research Group) organization, which is the founder of the Let's Encrypt project and contributes to the promotion of HTTPS and the development of technologies to improve Internet security.

It should be remembered that the proposed changes allow Rust to be used as a second language to develop kernel drivers and modules.

Rust drivers on Linux
Related article:
The second version of the patches for Rust driver support on Linux has been shipped

Rust support is advertised as an option that is not active by default and it does not result in Rust being included in the required basic build dependencies. Using Rust for driver development will allow you to create better and more secure drivers with minimal effort, without the hassle of accessing an area of ​​memory once freed, dereferencing null pointers, and exceeding buffer limits.

The new version of the patches continues to eliminate the comments made during the discussion of the first and second version of the patches and the most notable changes we can find:

Transitioned to Rust 1.57 stable version as a reference compiler and binding to the stabilized edition of the Rust 2021 language has been secured. The transition to the Rust 2021 p specificationallowed to start working to avoid using such unstable features in patches like const_fn_transmute, const_panic, const_unreachable_unchecked and core_panic and try_reserve.

It is also highlighted that development of the alloc version has continued from the Rust library, in the new version, the "no_rc" and "no_sync" options are implemented to disable the functionality which is not used in Rust code for the kernel, making the library more modular. We continue to work with the main alloc developers to bring the necessary kernel changes to the main library. The "no_fp_fmt_parse" option, which is required for the library to function at the kernel level, has been moved to Rust's base library (kernel).

Code cleaned up to remove possible compiler warnings when compiling the kernel in CONFIG_WERROR mode. When code is created in Rust, additional diagnostic compiler modes and Clippy linter warnings are included.

They proposed abstractions to use seqlocks (sequence locks), callback calls for power management, memory I / O (readX / writeX), interrupt and thread handlers, GPIO, device access, drivers and credentials in rust code.

Tools for driver development have been expanded with the use of relocatable mutexes, bit iterators, simplified bindings over pointers, improved fault diagnostics, and data bus independent infrastructure.

Work with links has been improved using the Ref type simplified, based on the refcount_t backend, which uses the central API of the same name to count references. Support for the Arc and Rc types provided in the standard mapping library has been removed and is not available in code executed at the kernel level (for the library itself, options have been prepared to disable these types).

A version of the PL061 GPIO driver, rewritten in Rust, has been added to the patches. A feature of the driver is that its near line-by-line implementation repeats the existing C GPIO driver. For developers who want to get acquainted with building controllers in Rust, a line-by-line comparison has been prepared, which provides insight into which builds in Rust the C code has become.

Rust's main codebase adopts rustc_codegen_gcc, a rustc backend for GCC that implements AOT compilation using the libgccjit library. With proper development of the backend, it will allow you to collect the Rust code involved in the kernel using GCC.
In addition to ARM, Google, and Microsoft, Red Hat has expressed interest in using Rust in the Linux kernel.

Finally, if you are interested in knowing more about it, you can consult the details In the following link.


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.