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

Few days ago, Miguel Ojeda, responsible for the development and submission of these proposals and author of the Rust-for-Linu projectx unveiled the seventh component proposal for device driver development Rust for Linux kernel developers to consider.

This is the seventh edition of the patches and to which even Rust support is considered experimental, but it is already included in the linux-next branch and is mature enough to start working on creating abstraction layers over kernel subsystems, as well as writing controllers 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.

The proposed changes make it possible to use Rust as a second language for developing drivers and kernel modules. 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 safer drivers with minimal effort, without problems like accessing a memory area after freeing it, dereference null pointers, and buffer overflows.

Main novelties in the seventh proposal

This new proposal highlights that the toolkit and a variant of the alloc library, which removed the possible generation of "panic" state on errors, updated to version Rust 1.60 and that thereby stabilizes support for the "may_uninit_extra" mode used in kernel patches.

In addition to this, it is noted that added ability to run tests from documentation (tests used concurrently as examples in the documentation), by converting compile-time tests bound to the kernel API into KUnit tests that run at kernel boot time. The tests are required not to produce a Clippy linter warning, as is the core Rust code.

Moreover an initial implementation of the "net" module with network functions is proposed. Rust code provides access to kernel network structures such as "Namespace" (based on the "struct net" kernel structure), SkBuff (struct sk_buff), TcpListener, TcpStream (struct socket), Ipv4Addr (struct in_addr), SocketAddrV4 (struct sockaddr_in) and its IPv6 equivalents.

the back end rustc_codegen_gcc, has implemented the ability to start the rustc compiler. Compiler commissioning refers to rustc's ability to use a GCC-based code generator to build the rustc compiler.

Also, the recent release of GCC 12.1 includes fixes to libgccjit that are necessary for rustc_codegen_gcc to work properly. Preparations are underway to provide the ability to install rustc_codegen_gcc using the rustup utility.

Of the other changes that stand out of this new version:

  • Initial support implemented for asynchronous programming methods (async), implemented in the form of the kasync module.
  • Added net::filter module to manipulate network packet filters. Added example rust_netfilter.rs with filter implementation in Rust language.
  • Added implementation of a simple mutex smutex::Mutex that does not require pinning.
  • Added a NoWaitLock lock that never waits to be released, and if it is occupied by another thread, it fails trying to acquire the lock instead of stopping the caller.
  • Added a RawSpinLock lock, identified by raw_spinlock_t in the kernel, that applies to sections that cannot be idle.
  • Added ARef type for object references to which the reference counting mechanism is applied (always refuted).
  • Progress is seen in the development of GCC's gccrs frontend with the implementation of the Rust language compiler based on GCC. There are currently two full time developers working on gccrs.

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