It seems that patch development for Rust driver support on Linux has picked up a good pace Well, it was just over a month ago that the removed proposal was released, since since the third version a new proposal has been delivered every month and now the new proposal has been released, this being the sixth edition.
Miguel Ojeda has proposed the new release of the Rust device driver development components for Linux kernel developers to consider. This is the sixth edition still considered experimental but it is already included in the linux-next branch and is mature enough to start working on creating abstraction layers on top of kernel subsystems, as well as writing drivers and modules.
For those who are still unaware of this development, they should know that 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.
Remember that the proposed changes make it possible to use Rust as a second language to develop 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.
Memory safety is provided in Rust eAt compile time by checking references, tracking object ownership, and object lifetime (scope), as well as by evaluating the correctness of memory access during code execution. 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. .
In the new version of the patches, the comments made during the discussion of the first one were continued to be deleted, second, third, quarter y farm editions of the patches (of which I leave you their corresponding links).
Main novelties in the sixth proposal
With the arrival of this new proposal toolkit has been updated before the release of Rust 1.59.0, along with which a variant of the alloc library it also syncs with the new version of Rust, eliminating the potential for a "panic" state when errors occur, such as out of memory.
Another change that has been made is that now, instead of providing platform specification files pre-created destination they are generated dynamically based on the kernel configuration.
It is also noted that the HAVE_RUST kernel parameter has been added to enable it for Rust compatible architectures and that abstractions have been proposed for use in the Rust code of a hardware pseudo-random number generator.
On the other hand, it is mentioned that ability to use assembler inserts has been stabilized ("feature(global_asm)") and added support for creating host programs in Rust that are used in the kernel build process.
Of the other changes that stand out from this new proposal:
- The use of error codes without the "Error::" prefix (for example, "return Err(EINVAL)") was allowed to approximate the handling of error codes in C.
- Added "CString" type for native C strings. Combined formatter and buffer types.
- Added Bool and LockInfo traits.
- Simplified implementation of spin-locks.
Finally if you are interested in knowing more about it about this new proposal, you can consult the details In the following link.