The second version of the patches for Rust driver support on Linux has been shipped

In March of this year on the linux-next branch in which at the time it was working for the Linux kernel 5.13, An initial set of components was included to develop device drivers in the language Rust and now the request has been made to include a second edition of patches to add Rust support to the Linux kernel.

The person who has sent the request to the Linux developers is Miguel Ojeda, author of the Rust-for-Linux project and who we also talked about a few days ago, since he was hired to take charge of the "Prossimo" project which basically focuses on coordinating efforts to move the critical software infrastructure to a secure code to secure the Linux kernel memory with Rust (if you want to know more about the project, you can consult posting at the link below.)

Related article:
Prossimo, an ISRG project to secure Linux kernel memory with Rust

The request sent by Miguel Ojeda is a second updated version of the components for the development of device drivers in Rust language and in which the comments made during the discussion of the first version of the patches are deleted and to which Linus Torvalds already joined the discussion and suggested changing the logic to process some bit operations.

Inside the benefits that are mentioned are that safe memory management is guaranteed in Rust at compile time by checking references, tracking object ownership and lifetime of the object, as well as evaluating the correctness of memory access at run time.

Rust also provides integer overflow protection, requires mandatory initialization of variable values ​​before use, better handles errors in the standard library, adopts the concept of references and immutable variables by default, and offers strong static writing to minimize logical errors.

Of the changes that stand out of this new version of the patches it is mentioned:

  • The memory allocation code prevents the possibility of generating a panic when errors such as out of memory occur.
  • It includes a variant of the Rust alloc library, in which the code has been reworked to handle locks, but the end goal is to bring all the necessary features for the kernel to the main edition of alloc (the changes have already been prepared and carried over to the standard Rust library).
  • Instead of nightly builds, beta and stable versions can now be used rustc compiler to compile a Rust-enabled kernel. Currently rustc 1.54-beta1 is used as a reference compiler, but after the 1.54 release at the end of the month, it will be supported as a reference compiler.
  • Added support for writing tests using the standard Rust attribute "# [test]" and the ability to use doctests to use sample code from the documentation as tests.
  • Support for ARM32 and RISCV architectures was added in addition to the previously supported x86_64 and ARM64.
    Improved GCC implementations Rust (the GCC frontend for Rust) and rustc_codegen_gcc (the rustc backend for GCC), which now passes all benchmarks.
  • A new level of abstraction for Rust programs to use kernel mechanisms written in C, such as trees, reference counting objects, creating file descriptors, tasks, files, and I / O vectors.
  • The driver development components have improved support for the "file_operations" module, the "module!" Macro, macro logging, and rudimentary drivers (probe and delete).
  • Binder has support for passing file descriptors and LSM links.
  • A more functional example of a Rust driver, bcm2835-rng, is proposed for a hardware random number generator for Raspberry Pi boards.

Finally, if you are interested in knowing more about it, 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. 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.