Korniza për shkruajten e drejtuesve të mbrojtur për bërthamën Linux në gjuhën Rust

Josh Triplett, who works at Intel and is part of the committee overseeing the development of Crates.io, mentioned in his speech at the Open Source Technology Summit. paraqiti a working group aimed at bringing the Rust language to parity with the C language in the field of systems programming.

In the working group currently being formed, Rust developers, together with engineers from Intel, will prepare specifications defining the functionality that needs to be implemented in Rust for systems programming. Systems programming often requires low-level manipulations, such as executing privileged processor instructions and obtaining detailed information about the processor's state. Among the already developed capabilities for Rust, support for unnamed structures, unions, inline assembly (the 'asm!' macro), and the BFLOAT16 floating-point format are noted.

Josh believes that the future of systems programming lies with Rust, and in contemporary reality, the C language claims a place once held by Assembly. Rust
not only frees developers from the problems inherent to the C language arising from low-level memory work, but also provides the capability to apply modern programming paradigms in development.

During diskutim the presentation
Josh put forward the idea of adding the ability to develop drivers in the Rust language to the Linux kernel, which would allow for the creation of safe and higher-quality drivers with minimal effort, free from issues such as accessing memory after it has been freed, dereferencing null pointers, and buffer overflow.

Greg Kroah-Hartman, responsible for maintaining the stable branch of the Linux kernel, expressed his readiness to add a framework for developing drivers in Rust to the kernel if it provides real advantages over C, for example, offering safe bindings to the kernel API. Furthermore, Greg considers this framework only as an option, not enabled by default, so as not to include Rust among the building dependencies for the kernel.

It turned out that several teams are already working in this direction. For instance, developers from the company 'Fish in a Barrel'. përgatitur instrumenti për krijimin e moduleve të ngarkueshme për bërthamën Linux në gjuhën Rust, duke përdorur një grup abstrakt ndërfaqesh dhe strukturash bërthamore për të rritur mbrojtjen. Ndërfaqet gjenerohen automatikisht mbi bazën e skedave të titujve ekzistues të bërthamës me anë të utilitarit bindgen. Për ndërtimin e ndërfaqeve përdoret Clang. Modulet që ndërtohen përveç ndërfaqeve përdorin paketën staticlib.

PĂ«r paralel po zhvillohet njĂ« projekt tjetĂ«r, i fokusuar nĂ« zhvillimin e drejtuesve pĂ«r sisteme tĂ« integruara dhe pajisje tĂ« internetit tĂ« gjĂ«rave, i cili gjithashtu pĂ«rdor bindgen pĂ«r tĂ« gjeneruar ndĂ«rfaqet mbi bazĂ«n e skedave tĂ« titujve tĂ« bĂ«rthamĂ«s. Çadra lejon pĂ«rmirĂ«simin e sigurisĂ« sĂ« drejtuesve pa bĂ«rĂ« ndryshime nĂ« bĂ«rthamĂ« — nĂ« vend tĂ« krijimit tĂ« niveleve tĂ« reja tĂ« izolimit nĂ« bĂ«rthamĂ« pĂ«r drejtuesit, propozohen bllokimi i problemeve nĂ« fazĂ«n e kompilimitt, duke pĂ«rdorur njĂ« gjuhĂ« mĂ« tĂ« sigurt si Rust. Supozohet se qasja e tillĂ« mund tĂ« jetĂ« e kĂ«rkuar nga prodhuesit e pajisjeve qĂ« zhvillojnĂ« drejtues tĂ« pronarit me ngut pa kryer auditimin e duhur.

Nuk Ú gjithë funksionaliteti i planifikuar është realizuar ende, por çadra është tashmë plotësisht e përdorshme dhe është përdorur për shkrimin e një drejtuesi funksional për kontrollorin Ethernet LAN9512 USB, i cili ofrohet në pllakën Raspberry Pi 3. Si një implementim referencë për shkrimin e drejtuesit Rust, është përdorur drejtuesi ekzistues smsc95xx, i shkruar në gjuhën C. Vëreni se madhësia e modulit dhe shpenzimet e komponentëve të runtime gjatë zhvillimit të drejtuesit në Rust janë të papërfillshme, duke lejuar aplikimin e çadrës për pajisje me burime të kufizuara.

Burimi: opennet.ru

Blini hosting tĂ« besueshĂ«m pĂ«r faqe interneti me mbrojtje nga DDoS, serverĂ« VPS VDS đŸ”„ Blini hosting tĂ« besueshĂ«m pĂ«r faqe interneti me mbrojtje nga DDoS, serverĂ« VPS VDS | ProHoster