The possibility of integrating Rust support into the Linux 5.20 kernel is not ruled out

At the Open-Source Summit 2022 conference ongoing these days, in the FAQ section, Linus Torvalds mentioned the possibility of early integration in the Linux kernel of components to develop Device drivers in Rust.

So it was mentioned that Rust-enabled patches may be accepted in the next changelog that makes up the 5.20 kernel composition, scheduled for late September.

It should be remembered that since last year Rust has become one of the favorites to be included in various important projects and that during the time that has passed, work has already been done related to the implementation of Rust support.

Within the renowned projects that have been interested in rust since last year, we can highlight, for example, Android, since it was interested in Rust because it allows achieve performance close to C and C++ languages, allowing it to be used to develop low-level parts of the platform and components to interface with the hardware.

To ensure the security of C and C ++ code, Android uses sandbox isolation, static analysis, and fuzzing tests. Sandbox isolation capabilities are limited and have reached the limit of their capabilities (further fragmentation in processes is not practical from a resource consumption point of view).

Among the limitations of using sandbox, they mention the high overhead and higher memory consumption caused by the need to generate new processes, as well as the additional latency associated with the use of IPC.

Rust-Android
Related article:
Rust is already a favorite for Android development

On the other hand, we must not forget that Linus Torvalds also gave his opinion on Rust and in which spent reviewing the implementation patch of possibilities to set Rust language drivers in Linux kernel and voiced some criticism.

The biggest complaints were caused by escape potential "Run-time failure panicen" in wrong situations, for example, in an out-of-memory situation, when dynamic memory allocation operations, including kernel operations, may fail.

Torvalds stated that such a focus on the kernel is fundamentally unacceptable, And if you don't understand this point, you can completely reject any code that tries to use such an approach. On the other hand, the developer of the patch agreed with the problem and found it solvable.

Linus Torvalds
Related article:
Rust was not exempt from the criticisms of Linus Torvalds

But it's been several months since Linus gave his feedback and hard work has been done to improve the implementation. As such, a pull request for the core has not currently been submitted to Torvalds yet, but the patch set was further revised, keynotes removed, tested on the linux-next branch for quite some time, and brought to a state suitable for building abstraction layers on top of kernel subsystems, writing drivers and modules.

Rust support comes as an option which is not enabled by default and does not result in Rust being included among the required build dependencies for the kernel.

The proposed changes make it possible to use Rust as a second language to develop drivers and kernel modules. 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 at 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.


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.