Khatiso ea bobeli ea li-patches bakeng sa kernel ea Linux ka tšehetso bakeng sa puo ea Rust

Miguel Ojeda, sengoli sa projeke ea Rust-for-Linux, o khothalelitse mofuta o ntlafalitsoeng oa likarolo bakeng sa ho nts'etsapele bakhanni ba lisebelisoa ka puo ea Rust bakeng sa ho hlahlojoa ke baetsi ba Linux kernel. Tšehetso ea mafome e nkoa e le liteko, empa e se e lumellane hore e kenyelelitsoe lekaleng le latelang la linux. Phetolelo e ncha e felisa litlhaloso tse entsoeng nakong ea lipuisano tsa phetolelo ea pele ea li-patches. Linus Torvalds o se a kene lipuisanong mme a etsa tlhahiso ea ho fetola mohopolo bakeng sa ho sebetsana le lits'ebetso tse ling.

Hopola hore liphetoho tse reriloeng li etsa hore ho khonehe ho sebelisa Rust e le puo ea bobeli bakeng sa ho ntlafatsa bakhanni le li-module tsa kernel. Tšehetso ea mafome e hlahisoa e le khetho e sa sebetseng ka ho sa feleng 'me e sa etse hore Rust e kenyelelitsoe e le ho itšetleha ho hlokahalang bakeng sa kernel. Ho sebelisa Rust bakeng sa nts'etsopele ea mokhanni ho tla u lumella ho theha bakhanni ba sireletsehileng le ba betere ka boikitlaetso bo fokolang, ntle le mathata a joalo ka phihlello ea mohopolo ka mor'a ho lokolla, li-null pointer dereferences, le buffer overruns.

Ho sebetsa ka mokhoa o sireletsehileng oa memori ho fanoa ka Rust ka nako ea ho bokella ka ho hlahloba litšupiso, ho boloka tlaleho ea botho ba ntho le nako ea bophelo ba ntho (scope), hammoho le ka tlhahlobo ea ho nepahala ha phihlello ea mohopolo nakong ea ts'ebetso ea khoutu. Rust e boetse e fana ka ts'ireletso khahlano le phallo e felletseng, e hloka ho qalisoa ha boleng bo fapaneng pele e sebelisoa, e sebetsana le liphoso hantle laeboraring e tloaelehileng, e sebelisa mohopolo oa litšupiso tse ke keng tsa fetoha le tse fapaneng ka mokhoa o ikhethileng, e fana ka ho thaepa ho tiileng ho fokotsa liphoso tse utloahalang.

Liphetoho tse hlokomelehang haholo mofuteng o mocha oa li-patches:

  • Khoutu ea kabo ea memori e qoba monyetla oa ho hlahisa boemo ba "ho tšoha" ha liphoso tse kang ho tsoa mohopolong li etsahala. Phapang ea laebrari ea Rust alloc e kenyelelitsoe, e nchafatsang khoutu ho sebetsana le liphoso, empa sepheo sa mantlha ke ho fetisetsa likarolo tsohle tse hlokahalang bakeng sa kernel khatisong e kholo ea alloc (liphetoho li se li lokisitsoe le ho fetisetsoa maemong a tloaelehileng. Laebrari ea mafome).
  • Sebakeng sa ho haha ​​​​bosiu, joale u ka sebelisa litokollo tsa beta le litokollo tse tsitsitseng tsa moqapi oa rustc ho bokella kernel ka tšehetso ea Rust. Hona joale, rustc 1.54-beta1 e sebelisoa e le moqapi oa litšupiso, empa ka mor'a hore tokollo ea 1.54 e lokolloe qetellong ea khoeli, e tla tšehetsoa e le moqapi oa litšupiso.
  • Tšehetso e ekelitsoeng bakeng sa liteko tsa ho ngola ho sebelisa tšobotsi e tloaelehileng ea "#[test]" bakeng sa Rust le bokhoni ba ho sebelisa li-doctest ho ngola liteko.
  • Ts'ehetso e ekelitsoeng bakeng sa meralo ea meralo ea ARM32 le RISCV ho kenyelletsa x86_64 le ARM64 tse neng li tšehelitsoe pele.
  • Ts'ebetsong e ntlafalitsoeng ea GCC Rust (GCC frontend for Rust) le rustc_codegen_gcc (rustc backend for GCC), eo hajoale e fetisang liteko tsohle tsa mantlha.
  • Ho khothaletsoa hore ho sebelisoe "Rust" mananeong a kernel a ngotsoeng ho C, joalo ka lifate tse khubelu tse ntšo, lintho tse baloang, pōpo ea litlhaloso tsa faele, mesebetsi, lifaele le li-vector tsa I / O.
  • Likarolo tsa ntlafatso ea bakhanni li ntlafalitse ts'ehetso bakeng sa mojule oa li-file_operations, module! macro, macro registration, le rudimentary drivers (probe and remove).
  • Hona joale Binder e ts'ehetsa litlhaloso tsa faele tse fetang le lihakisi tsa LSM.
  • Mohlala o sebetsang haholoanyane oa mokhanni oa Rust o reriloe - bcm2835-rng bakeng sa jenereithara ea linomoro tse sa sebetseng tsa liboto tsa Raspberry Pi.

Ho feta moo, merero ea lik'hamphani tse ling e amanang le ts'ebeliso ea Rust kernel e boleloa:

  • Microsoft e bontšitse thahasello ea ho kenya letsoho mosebetsing oa ho kopanya tšehetso ea Rust ho Linux kernel mme e ikemiselitse ho fana ka ts'ebetsong ea mokhanni bakeng sa Hyper-V on Rust likhoeling tse tlang.
  • ARM e sebetsa ho ntlafatsa tšehetso ea Rust bakeng sa litsamaiso tse thehiloeng ho ARM. Morero oa Rust o se o hlahisitse liphetoho tse tla etsa hore litsamaiso tsa 64-bit ARM e be sethala sa Tier 1.
  • Google e fana ka ts'ehetso ka kotloloho bakeng sa projeke ea Rust bakeng sa Linux, e nts'etsapele ts'ebetsong e ncha ea mokhoa oa puisano oa Binder interprocess ho Rust, 'me e nahana ka monyetla oa ho lokisa bakhanni ba fapaneng ba Rust. Ka ISRG (Internet Security Research Group), Google e fane ka chelete bakeng sa mosebetsi ho kopanya tšehetso ea Rust ho Linux kernel.
  • IBM e kentse ts'ehetso ea kernel bakeng sa Rust bakeng sa litsamaiso tsa PowerPC.
  • LSE (Systems Research Laboratory) e thehile mokhanni oa SPI Rust.

Source: opennet.ru

Eketsa ka tlhaloso