The fifth edition of patches for the Linux kernel with Rust language support

Miguel Ojeda, the author of the Rust-for-Linux project, proposed the fifth option for components for developing device drivers in the Rust language for consideration by Linux kernel developers. Rust support is seen as experimental but is already included in the linux-next branch and is sufficiently developed to begin creating abstraction layers over 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 enhance internet security.

As a reminder, the proposed changes allow Rust to be used as a secondary language for developing drivers and kernel modules. Rust support is presented as an option, not enabled by default, and does not lead to Rust being included among the mandatory build dependencies for the kernel. Using Rust for driver development will enable creating secure and higher-quality drivers with minimal effort, free from issues such as dereferencing freed memory, null pointer dereferencing, and buffer overflows.

Safe memory handling in Rust is ensured at compile time through reference checking, ownership tracking of objects, and considerations of object lifetimes (scope), as well as runtime checks for correctness in memory access. Rust also provides protections against integer overflows, requires variables to be initialized before use, manages errors more effectively in the standard library, employs immutability by default for references and variables, and offers strong static typing to minimize logical errors.

The new patch version continues to address the issues raised during the discussions of the first, second, third, and fourth patch revisions. In the new version:

  • The continuous integration system based on the bot 0DAY/LKP supported by Intel has added checks for Rust support components and started publishing testing reports. Integration of Rust support into the KernelCI automated testing system is being prepared. Testing based on GitHub CI has been shifted to the use of containers.
  • Kernel modules in Rust are no longer required to define crate attributes ‘#![no_std]’ and ‘#![feature(…)]’.
  • Support for single build targets (.o, .s, .ll, and .i) has been added.
  • The coding style guidelines have specified rules regarding the separation of comments (‘//’) and code documentation (‘///’).
  • The script is_rust_module.sh has been rewritten.
  • Support for static (global shared variables) synchronization primitives based on the implementation of ‘CONFIG_CONSTRUCTORS’ has been added.
  • Lock management has been simplified: Guard and GuardMut have been combined into a single parameterized type.
  • The ability to define additional parameters when registering devices has been provided.
  • A new abstraction ‘RwSemaphore’ acting as a wrapper over the C structure rw_semaphore has been added.
  • A new module mm and an abstraction VMA (a wrapper over the structure vm_area_struct) have been added for the use of mmap.
  • The GPIO PL061 driver has been refactored to use the macro ‘dev_*!’.
  • A general code cleanup has been conducted.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster