The integration of Rust in Linux has had a high level of acceptance by the community and developers
During the "Linux Plumbers 2022" conference that was taking place these days, an engineer from Western Digital gave a presentation on the development of an experimental driver for NVM-Express (NVMe) SSDs written in Rust and running at the Linux kernel level.
Although the project is still in an early stage of development , the tests performed showed that the performance of the Rust NVMe driver corresponds to the NVMe driver written in C in the kernel.
I'm Matthew Wilcox, I'm one of the authors of the NVMe spec, I was the one who suggested I make an NVMe driver to demonstrate the value of Rust. It has been successful beyond my wildest expectations.
Regarding the report presented, it states that the current NVMe C driver is completely satisfactory for developers, but the NVMe subsystem is a good platform to explore the feasibility of developing drivers in Rust, as it is quite simple, widely used, has high performance requirements, has a proven reference implementation for comparison, and supports various interfaces (dev, pci, dma, blk-mq, gendisk, sysfs).
It is observed that the Rust PCI NVMe controller already provides the necessary functionality for operation, but it is not yet ready for widespread use, as it requires separate improvements.
Future plans include getting rid of existing unsafe blocks , support for removing the device and unloading the driver, supporting the sysfs interface , implementing deferred initialization, creating a driver for blk-mq, and experimenting with an asynchronous scheduling model for queue_rq.
Furthermore, we can highlight the experiments conducted by the NCC Group to develop Rust drivers for the FreeBSD kernel . One example is a simple echo driver that returns data written to the /dev/rustmodule file. In the next phase of experimentation, the NCC Group is considering reworking core kernel components in Rust to improve the security of network and file operations.
That said, although it has been shown that it is possible to create simple modules in Rust, a tighter integration of Rust into the FreeBSD kernel will require additional work.
For example, he mentions the need to create a set of abstraction layers over kernel subsystems and structures, similar to the plugins prepared by the Rust project for Linux. In the future, we plan to perform similar experiments with the Illumos core and highlight common abstractions in Rust that could be used in drivers written by Rust for Linux, BSD, and Illumos.
According to Microsoft and Google, around 70% of vulnerabilities in their software products are due to insecure memory management.
The use of the Rust language is supposed to reduce the risk of vulnerabilities caused by unsafe memory management and eliminate the occurrence of errors such as accessing a memory area after it has been freed 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 protection against integer overflows , requires variables to be initialized before use, handles errors better than the standard library, applies the concept of references and immutable variables by default, and offers strong static typing to minimize logical errors.
It is worth mentioning that it may be possible that future work will go hand in hand with the work that Miguel Ojeda has presented on his "Rust for Linux" drivers, which have been presented as a series of patches.
Finally, if you are interested in learning more about this , you can find the details at the following link.