The fourth version of the patches for Rust driver support on Linux has been published

Miguel Ojeda, author of the Rust-for-Linux project, Teme recently unveiled the fourth proposal for device driver components Rust for Linux kernel developers to consider.

Rust support is considered experimental, but it has already been agreed to be included in the linux-next branch and is mature enough to start working on abstraction layers on top of kernel subsystems, as well as writing drivers and modules. The development is funded by Google and the ISRG (Internet Security Research Group), which is the founder of the Let's Encrypt project and promotes HTTPS and the development of technologies to increase Internet security.

For those who are still unaware of the proposed changes, they should know that they make it possible the use of Rust as a second language to develop controllers and modules of the kernel. Rust support is presented as an option that is not enabled by default and does not result in Rust being included among the required build dependencies for the kernel.

Using Rust to develop drivers will allow you to create better and more secure drivers with minimal effort, without problems like accessing a memory area after freeing it, dereferencing null pointers, and buffer overflows.

Memory safety is provided in Rust at compile time by checking references, tracking object ownership, and object lifetime (scope), as well as by evaluating the correctness of memory access during the execution of the code.

Rust also provides integer overflow protection, requires variables to be initialized before use, better handles errors in the standard library, enforces the concept of immutable variables and references by default, and offers strong static typing to minimize logical errors. .

What are the changes in the fourth installment?

In this new version of the patches that are presented, it is mentioned that the comments made during the discussion of the first, second and third edition of the patches continued to be eliminated.

We'll keep updating until we don't depend on any unstable features;
at which point we may want to start declaring a minimal version of Rust
is supported, as is done, for example, for GCC and Clang.

Similarly, we also migrated to the 2021 edition of the Rust language.

As for the other changes that were made in this new version, the announcement mentions the following:

  • Transitioned to use stable Rust 1.58.0 as the reference compiler.
  • Changes required for the project, not yet included in the main Rust toolkit, include the "-Zsymbol-mangling-version=v0" flag (expected in Rust 1.59.0) and the "maybe_uninit_extra" mode (expected in Rust 1.60.0).
  • Automatic checks for the availability of Rust tools and their suitability have been added, and the ability to test Rust support on the system has also been expanded.
  • New abstractions are proposed to be able to access the device identifier tables ("IdArray" and "IdTable") from the Rust code.
  • Added layers for calling functions that are related to the timer (clock frame).
  • Platform controllers are now defined through trait implementations.
  • A new macro has been added in order to simplify platform driver registration and a new generic driver template has been proposed.
  • Added new macros for "dev_*" structures.
  • Added new methods "{read,write}*_relaxed" for IoMem type .
  • Removed FileOpener property to simplify file operations.
  • Added "ThisModule" parameter to the number of arguments passed during controller registration.
  • A typical template for creating kernel modules in the Rust language is proposed.

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


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: 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.