Iyo yechisere vhezheni yezvigamba zveRust mutyairi rutsigiro paLinux inosvika

Miguel Ojeda, munyori weRust-for-Linux project akasunungura kusunungurwa kwechisere yekugadzira Linux kernel patches neRust mutauro rutsigiro rweLinux kernel vanogadzira kuti vafunge.

Izvi zvinomira seyepfumbamwe kuburitswa kwezvigamba (tichifunga nezvekutanga kuburitswa vhezheni isina nhamba yevhezheni). Rutsigiro rwengura runoonekwa sekuyedza, asi yakatoverengerwa mulinux-inotevera bazi, zvirevo zvekubatanidzwa mukudonha kuburitswa kwe5.20/6.0, uye yakakwira zvakakwana kuti itange kushanda pakugadzira abstraction layers pamusoro peiyo kernel subsystems, pamwe nekunyora controllers uye modules.

Iyo budiriro inotsigirwa neGoogle neISRG (Internet Security Research Group), inova muvambi weLet Encrypt project uye inosimudzira HTTPS nekuvandudzwa kwetekinoroji yekuwedzera kuchengetedzeka kweInternet.

Idzo shanduko dzakarongwa dzinoita kuti zvikwanise kushandisa Rust semutauro wechipiri wekugadzira vatyairi uye kernel module. Rutsigiro rutsigiro runounzwa sechisarudzo chisingagoneswe nekukasira uye hachikonzereri kuti Rust ibatanidzwe pakati pezvinodiwa zvekuvaka kernel. Kushandisa Rust kugadzira madhiraivha kuchakubvumidza kuti ugadzire madhiraivha ari nani uye akachengeteka nekuedza kushoma, pasina matambudziko sekuwana nzvimbo yendangariro mushure mekuisunungura, dereference null pointers, uye buffer mafashama.

Kuchengetedzwa kwendangariro kunopihwa muRust panguva yekuunganidza nekutarisa mareferensi, kuteedzera chinhu muridzi, uye chinhu hupenyu hwese (chiyero), pamwe nekuongorora iko kurongeka kwekuyeuka kwekuwana panguva yekuitwa kwekodhi.

Chii chitsva mukuburitswa kwechisere uku?

Muchikumbiro chitsva ichi chakaburitswa, zvinonzi iyo alloc library musiyano, iyo yakabvisa chizvarwa chinogona kuitika che "kutya" mamiriro pamusoro pezvikanganiso, yakagadziridzwa kuRust vhezheni 1.62. Kuenzaniswa neshanduro yapfuura, Rust toolkit yakatsigisa rutsigiro rwe const_fn_trait_bound mashandiro anoshandiswa muma kernel patches.

Kunze kwazvo iyo binding code inoparadzaniswa kuita bundle re "bindings" mabhokisi zvakasiyana, izvo zvinoita kuti zvive nyore kuvaka patsva kana chete main kernel package yakashandurwa.

Iyo kuitwa kwe "concat_idents!" macro, Yakanyorwa patsva senzira yemaitiro macro, isina kusungirirwa kune concat_idents mashandiro uye kubvumira kushandiswa kwemareferensi emunharaunda.

Mukuwedzera, zvinonzi iyo macro "static_assert!" rakanyorwa patsva kuti ribvumire "core::assert!()" rinoshandiswa mune chero mamiriro pachinzvimbo checonstants, nepo macro "construction_error!" yakagadziridzwa kushanda pakuseta "RUST_BUILD_ASERT_{WARN,ALLOW}" modhi yemamodule.

fs module yakawedzerwa iyo inopa zvinongedzo zvekushanda nemafaira masisitimu. Muenzaniso weiyo yakapfava faira system yakanyorwa muRust inokurudzirwa, pamwe neiyo basa queue module yakawedzerwa kushanda nehurongwa mitsara.

Yeimwe shanduko izvo zvinomira pachena kubva pachikumbiro chitsva ichi:

  • Yakawedzera imwe faira yekumisikidza "kernel/configs/rust.config".
  • Mafaira e "*.i" akagadziriswa mune macro substitutes akatumidzwa zita rekuti "*.rsi".
  • Yakabviswa rutsigiro rwekuvaka Rust zvikamu zvine optimization mazinga kunze kweaya anoshandiswa kuC kodhi.
  • Kuvandudzwa kwekasync module kwakaenderera mberi nekushandiswa kweasynchronous programming nzira (async).
  • Yakawedzera muenzaniso wekernel level TCP server yakanyorwa muRust uye yakawedzera kugona kubata zvinokanganisa muRust.
  • Yakawedzera maitiro macro kuita kuti zvive nyore kushanda nematafura ekunongedza, senge file_operations chimiro.
  • Yakawedzerwa bidirectional yakabatana runyorwa rwekuita "unsafe_list::List".
  • Yakawedzera rutsigiro rwekutanga rweRCU uye Guard mhando yekutarisa kana kiyi yekuverenga yakasungwa kune yazvino shinda.
  • Yakawedzera basa Task :: spawn () kuti uzvibudise uye utange kernel tambo.
  • Iyo Basa :: wake_up () nzira yakawedzerwa zvakare.
  • Yakawedzera kunonoka module

Finalmente kana iwe uchifarira kuziva zvakawanda nezvazvo, unogona kutarisa ruzivo Mune inotevera chinongedzo.


Izvo zviri muchinyorwa zvinoomerera pamisimboti yedu ye tsika dzekunyora. Kuti utaure chikanganiso tinya pano.

Iva wekutanga kutaura

Siya yako yekutaura

Your kero e havazobvumirwi ichibudiswa.

*

*

  1. Inotarisira data: AB Internet Networks 2008 SL
  2. Chinangwa cheiyo data: Kudzora SPAM, manejimendi manejimendi.
  3. Legitimation: Kubvuma kwako
  4. Kutaurirana kwedata
  5. Dhata yekuchengetedza: Dhatabhesi inobatwa neOccentus Networks (EU)
  6. Kodzero: Panguva ipi neipi iwe unogona kudzora, kupora uye kudzima ruzivo rwako