Rust support for the Linux kernel has faced criticism from Torvalds.

Linus Torvalds reviewed patches implementing the ability to create drivers in Rust for the Linux kernel and made some critical comments.

The main concerns were about the potential to panic() in error situations, such as memory shortages, where dynamic memory allocation operations, including those within the kernel, could fail. Torvalds stated that such an approach is fundamentally unacceptable in the kernel, and without an understanding of this point, he could completely reject (totally NAKed) any code attempting to use this approach. On the other hand, the developer working on the patches agreed with this issue and considers it solvable.

Another problem arose from attempts to use floating-point computations or 128-bit types, which are not permissible in environments like the Linux kernel. This turned out to be a more serious issue, as the current core Rust library is indivisible and exists as one large blob — there is no way to request only certain features, preventing the use of problematic functionalities. Solving this issue may require changes in the Rust compiler and library, and at this point, the team does not yet have a strategy for implementing library modularity.

Additionally, Torvalds pointed out that the provided driver example is useless and advised including a real-world driver that addresses a concrete task as an example.

Addition: Google announced its involvement in the initiative to promote Rust support in the Linux kernel and detailed the technical aspects of the feasibility of introducing Rust to address memory error issues. Google believes that Rust is already ready to join C as a language for developing Linux kernel components. The article also provides examples of using Rust to develop kernel drivers, particularly in the context of its use on the Android platform (Rust is recognized as an officially supported language for Android development).

It has been noted that Google has prepared an initial prototype of a Binder inter-process communication driver written in Rust, which will allow for a detailed comparison of the performance and security of Binder implementations in C and Rust. As it stands, the work is not yet complete, but layers have already been prepared for almost all the basic abstractions of the kernel functionality needed for Binder to use these abstractions in Rust code.

Source: opennet.ru

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