WD utvecklar en NVMe-drivrutin pÄ Rust-sprÄket. Experiment med Rust i FreeBSD

Under the ongoing Linux Plumbers Conference 2022, an engineer from Western Digital presented a report on the development of an experimental driver for SSDs with an NVM-Express (NVMe) interface, written in Rust and operating at the Linux kernel level. Although the project is still in its early stages, testing has shown that the performance of the Rust NVMe driver matches that of the existing NVMe driver in the kernel, which is written in C.

WD utvecklar en NVMe-drivrutin pÄ Rust-sprÄket. Experiment med Rust i FreeBSD
WD utvecklar en NVMe-drivrutin pÄ Rust-sprÄket. Experiment med Rust i FreeBSD

The report states that the current NVMe driver in C fully satisfies the developers, but the NVMe subsystem serves as a good testing ground for assessing the feasibility of developing drivers in Rust, as it is simple enough, widely used, demands high performance, has a tested reference implementation for comparison, and supports various interfaces (dev, pci, dma, blk-mq, gendisk, sysfs).

It is noted that the PCI NVMe driver in Rust already provides the necessary functionality for operation but is not yet ready for widespread use as it requires further enhancements. Future plans include eliminating existing unsafe blocks from the code, supporting device removal and driver unloading operations, adding sysfs interface support, implementing deferred initialization, creating a driver for blk-mq, and experimenting with using an asynchronous programming model for queue_rq.

Spela video

Additionally, it can be noted that experiments conducted by NCC Group aim to develop drivers in Rust for the FreeBSD kernel. As an example, a simple echo driver that returns data written to the file /dev/rustmodule is examined in detail. In the next phase of the experiments, NCC Group is considering the possibility of rewriting core components in Rust to enhance the security of network and file operations.

Trots att möjligheten att skapa enkla moduler pÄ Rust-sprÄket visas, kommer en djupare integration av Rust i FreeBSD-kÀrnan att krÀva ytterligare arbete. Till exempel nÀmns behovet av att skapa ett set av abstraktionslager över subsystem och kÀrnstrukturer, liknande tillÀgg som förberetts av projektet Rust for Linux. I framtiden planeras liknande experiment med Illumos-kÀrnan och att identifiera gemensamma abstraktioner pÄ Rust som kan anvÀndas i Rust-baserade drivrutiner för Linux, BSD och Illumos.

Enligt Microsofts och Googles uppgifter orsakar cirka 70% av sÄrbarheterna i deras programvaror osÀkert minnesarbete. Det antas att anvÀndningen av Rust-sprÄket kan minska risken för sÄrbarheter orsakade av osÀker minneshantering och eliminera fel som tillgÄng till minnesomrÄden efter att de har frigjorts samt buffertöverskridningar.

SÀker minneshantering sÀkerstÀlls i Rust vid kompilering genom kontroll av referenser, spÄrning av Àgande av objekt och beaktande av objektens livstid (synlighet), samt genom utvÀrdering av korrekt tillgÄng till minnet under kodens körning. Rust tillhandahÄller ocksÄ verktyg för skydd mot heltalsöverflöden, krÀver obligatorisk initialisering av variabelvÀrden innan anvÀndning, hanterar fel bÀttre i standardbiblioteket, tillÀmpar konceptet av oförÀnderliga (immutable) referenser och variabler som standard och erbjuder stark statisk typning för att minimera logiska fel.

KĂ€lla: opennet.ru

Köp pĂ„litlig webbhotell med DDoS-skydd, VPS VDS-servrar đŸ”„ Köp pĂ„litlig webbhotell med DDoS-skydd, VPS VDS-servrar | ProHoster