Christoph Hellwig, a maintainer of the DMA, KVM, Slab Allocator subsystems, and PowerPC architecture in the Linux kernel, has fundamentally refused to accept Rust bindings for the DMA subsystem into the kernel. He joined the discussion on the Rust support rules within the kernel published by the Rust for Linux project. According to Christoph, such rules are useless until they are agreed upon with the community and included in the kernel documentation.
Christoph also pointed out that the rules contain incorrect information regarding maintainers' ability to make independent decisions about including Rust-related code in their subsystems. Christoph claims that Linus Torvalds stated in a private conversation that he is firmly determined to accept Rust code into the kernel, despite maintainers' objections. Thus, developers and kernel maintainers will now have to deal with Rust, whether they want to or not.
Christoph again compared the spread of Rust bindings to a cancerous tumor that will spread to all kernel subsystems and lead to fragmentation. From a unified whole, the kernel is turning into a project written in several languages, with no clear definition of when to use which language. According to Christoph, working with such a mixed codebase has become his worst nightmare, as code is constantly rewritten from one language to another and then back again under such conditions.
At the same time, Christoph asks to clarify the purpose of introducing Rust into the kernel. If the goal is to solve security issues arising from low-level memory work, then modernization of the existing code is primarily required. Given that maintainers react painfully even to trivial matters, such as checks for integer overflow, it is unclear how to bridge the gap between one part of the kernel that does not accept even simple safety rules and another part that adheres strictly to enforcement. If the goal is to simplify driver development, then the introduction of support for yet another language will only add more work and increase the burden on the already overloaded individuals maintaining the kernel's infrastructure.
A Rust integrációjának hívei a következő célokat emelik ki:
- Az új kód Rust nyelven történő írása csökkenti a memóriahasználat során fellépő hibák és versenyhelyzetek kockázatát, valamint kizárja egyes logikai hibákat.
- A karbantartóknak könnyebb lesz felülvizsgálni a változtatásokat és refaktorálni a modulokat a Rust nyelv által nyújtott garanciák figyelembevételével.
- A Rust nyelv fejlett lehetőségeit kihasználó absztrakciók egyszerűsíteni fogják az új driverek és modulok létrehozását.
- A modern nyelv támogatása új résztvevőket vonz a kernel fejlesztéséhez.
- A Rust eszközeinek alkalmazása egyszerűsíti a kód dokumentálásának követelményeit. Például a Rust for Linux projektben kötelezővé vált a nyilvános API-k, biztonsági követelmények, unsafe blokkok és típus invariánsok dokumentálása.
Forrás: opennet.ru
