paint-brush
Lapho Ukufakwa Kwekhodi Kunquma Ukusinda Kwedolobhange@pepitoscrespo
334 ukufundwa
334 ukufundwa

Lapho Ukufakwa Kwekhodi Kunquma Ukusinda Kwedolobha

nge pepitoscrespo19m2024/10/07
Read on Terminal Reader

Kude kakhulu; Uzofunda

Ingabe i-C++ ingadlula i-Rust ekulawuleni nasekuvikelekeni kwesistimu yomhlaba wangempela? Gxumela empini yabaduni ukuze usindise i-LuxCity futhi uhlole imikhawulo yazo zombili izilimi
featured image - Lapho Ukufakwa Kwekhodi Kunquma Ukusinda Kwedolobha
pepitoscrespo HackerNoon profile picture
0-item


Thina bahleli bohlelo sivame ukuzithola sibambe iqhaza ezingxoxweni - C++ vs. Rust, izinga eliphezulu uma liqhathaniswa nezinhlelo ezisezingeni eliphansi. Kodwa inselele yangempela ayikona nje ukwenza izinhlelo zikanokusho; iyabavikela emhlabeni wanamuhla onenethiwekhi, lapho ikhodi enonya ihlale icashe khona. Kungakhathaliseki ukuthi ikhodi yakho ibonakala ingenasici kangakanani, ukuziba izinsongo ezingaba khona kuyisimemo senhlekelele.


Akwanele ukupeca izimbobo zokuphepha noma ukukhulula isibuyekezo esilandelayo. Impi yangempela isekukhuphukeni kwempendulo ephumelelayo lapho - yebo, nini, hhayi uma - uhlelo lwakho luphulwa. Lokhu kusho ukusebenzisa ukutholwa kokungenela okusebenzayo, izindlela zokuzivikela ezizenzakalelayo, futhi ngezinye izikhathi ungcolise izandla zakho ngohlelo olusezingeni eliphansi ukuze ubhekane nezinsongo emthonjeni wazo.


Inkundla yempi idlulela ngale komqondo wezinga eliphezulu ukuya emnyombweni wesistimu, lapho kuphela onjiniyela abanekhono kakhulu abangazilwela ngempumelelo. Uma ungazimisele ukulwa nokuhlasela kuleli zinga, zonke izici zokuphepha emhlabeni ngeke zikusindise. Ku-cybersecurity, ukuvikela ngaphandle kwekhono lokuphendula akwanele.


Uhlangothi Olumnyama Lomndeni Onamandla C, Ukuphakama Kwe-Rootkits: Ikhodi Encane, Amandla Amakhulu

Kulungile, ake sikhulume ngomndeni wakwa-C - C, C++, lonke iqembu. Lezi zilimi zikunikeza inkululeko yokugcina. Ungakha amasistimu amahle, asebenza kahle kakhulu azokwenza ontanga yakho babe nomona. Kodwa nali uhlangothi: leyo nkululeko efanayo ikuvumela ukuthi udale enye ikhodi eyingozi kakhulu laphaya - ama-rootkits kanye nabazala babo abachwensayo, ama-bootkits. Lena akuzona nje imigqa engenangozi yekhodi elokhu izungeza — zingabahlaseli abathule bomhlaba wesoftware.


Ngakho-ke, uyini umehluko wangempela phakathi kwama-rootkits nama-bootkits?

  • Ama-Rootkits aklanyelwe ukusebenza ngaphakathi kwesistimu yokusebenza. Bakhohlisa izinqubo zesistimu, bafihla imisebenzi enonya, futhi balungise izinhlelo zesofthiwe. Kepha bayakhahlela ngemuva kokuthi i-OS iqalile.

  • Ama-bootkits akushaya kakhulu. Bahlasela uhlelo ngaphambi kokuthi i-OS isebenze. Bathelela i-Master Boot Record (MBR) noma i-UEFI/BIOS firmware, bathola ukulawula ngaphambi kokuba i-OS yakho yenze okuthile ngakho.


Esikhathini esiningi, lokho abantu abakucabangayo njengokuhlasela kwe-rootkit empeleni kuyinhlanganisela yakho kokubili. Ama-bootkits athatha izintambo kusukela ekuqaleni, kuyilapho ama-rootkits engenela lapho i-OS isiqalile futhi isebenza, ivumela ukuhlasela kuqhubeke kunganakwa. Ngokuyisisekelo, ama-bootkits angena kusenesikhathi, ama-rootkits agcina umbukiso uqhubeka.


Manje, mhlawumbe uyacabanga: “ Kuyini ukuthengiselana uma i-OS ifakwe ikhodi ku-Rust esikhundleni se-C/C++/Assembly okuthiwa ayiphephile?


Nakhu lapho izinto ziba nentshisekelo kuyo. Masibe ngokoqobo — emhlabeni wanamuhla wezobuchwepheshe, sisebenzisana namasistimu ayingxube, amanethiwekhi ahlanganiswe kumawebhu ayinkimbinkimbi lapho ukusebenza nokulawula okunembayo kubaluleke kakhulu. Cabanga ngezinhlelo ze-SCADA , izilawuli ze-HVAC , amasistimu esikhathi sangempela , ikhompuyutha esemaphethelweni , amadivayisi ashumekiwe — uthola umbono. Kulezi zimo, kungakhathaliseki ukuthi ulimi “luphephe” kangakanani, usathembele kakhulu ku-C/C++/Assembly ngalokho kulawula nokusebenza okucolisekile.


Futhi noma ngabe uhlelo lwakhiwe nge-Rust, masithembeke - okuningi lusasebenzisa izingcezu ezinkulu zekhodi ye-Rust unsafe ukuze kubhekwane nezingqinamba zokusebenza, izinkinga ze-latency, izithiyo zememori, kanye nokuxhumana ngqo nehadiwe. Ekupheleni kosuku, lapho ukusebenza kuyinkosi, ugcina usesikebheni esifanayo. Lawo mabhulokhi unsafe ku-Rust? Zivula ubungozi obufanayo ongaba nabo ku-C/C++/Assembly.


Iqiniso liwukuthi: uma udinga ukulawula okucushwe kahle ezingeni lehadiwe, uhamba ngentambo efanayo, noma ngabe i-OS yakho ifakwe ikhodi ku-Rust noma enye into. Ngakho-ke nakuba i-Rust ingase inikeze ama-guardrails, leyo misebenzi unsafe yezinga eliphansi isesengozini. Ama-Rootkits nama-bootkits awanandaba nokuncamelayo kolimi—azothola indlela yawo uma kunokuqhekeka.


I-Rootkits Zone: Ngena Ngobungozi Bakho


Lezi zilwane ezidla ezinye zedijithali azigcini nje ngokuthelela uhlelo — zingabanikazi balo. Futhi nansi into esemqoka: eziningi zazo zakhiwe kusetshenziswa okungasoze kwabuna — C, C++, kanye ne-Assembly. Kulungile, izilimi ezifanayo ezinika amandla izinhlelo zakho zokusebenza ezisebenza kahle zingemuva kwamanye ama-rootkits amabi kakhulu ake adalwa.


Cabanga ngokuziphendukela kwemvelo umzuzwana . Kufana nohambo olusuka kulawo ma-dinosaur amancane, adlayo enkathi ye-Triassic kuya ezilo ezinde ze-theropod ze-Cretaceous, njenge-T-Rex. Njengalawo ma-dinos akudala aguqukela ekubeni yizilwane ezidla ezinye, ama-rootkits ashintshile asuka esiqalweni “esihle” abe ama-behemoth anamuhla asabekayo.


Thatha i-Hacker Defender , isibonelo - lesi silwane esihuquzelayo se-Cyber-reptile bekuyimigqa yekhodi engu-3K nje, sisebenzisa izikhala eziyisisekelo ze-OS. Kodwa njenganoma yimuphi umhlaseli omuhle, kwavela. Ama-rootkits anamuhla ayizilo ezinkulu, ahlukaniswe abe amamojula anezinkulungwane zemigqa yekhodi ngayinye, angaqondi nje kuphela amasistimu okusebenza kodwa futhi nokuba sengozini kwezinga lehadiwe. Umjaho wezikhali, i-rootkit ngayinye entsha icindezela imingcele yalokho okungenzeka.


Ngakho-ke, kulesi sihloko, singena ezindabeni ezimbili . Esokuqala? Inguqulo esemthethweni ozoyithola ezinsizeni zobuchwepheshe ezifana ne -Rootkits nama-Bootkits ka-Alexander Matrosov, Eugene Rodionov, kanye no-Sergey Bratus. Lona kuhle kakhulu umhlahlandlela wayo yonke imininingwane ye-nitty-gritty ye-rootkit evolution. Ukuze wenze izinto zibe lula kuwe, ngihlanganise i-cladogram ngezansi efingqa ukuthuthukiswa kwalawa ma-rootkits - igatsha ngalinye limelela ukugxuma okusha kuyinkimbinkimbi ye-malware.


Ngemva kwalokho, uzothola ithebula eligqamisa izici eziyingqayizivele ze-rootkit ngayinye. Ngithembe, uzofuna ukubona ukuthi lezi zingcezu zekhodi ziguquke kanjani kusukela kubahlaseli abancane abangosomathuba baba izilo ezibusa uhlelo.

Nazo-ke


Ukuvela kwe-Rootkits


I-Rootkit Evolution: Ukuqoqwa Ngemindeni

Ithebula libonisa ukuqhubeka kwama-rootkits ngokuhamba kwesikhathi, ligqamisa izici zawo eziguqukayo, izilimi zokuhlela ezisetshenzisiwe, kanye nosayizi wekhodi yazo.


Kodwa kunolunye uhlangothi lwale ndaba - umbono ovela kumuntu ongagcini nje ngokubhala ama-rootkits kodwa aphile futhi awaphefumule. Hlangana nomlingiswa wethu oyinhloko: isigebengu esibona ama-rootkits njengezandiso zakhe - i-symphony yekhodi eklanywe ngokucophelela ukuphazamisa nokubusa. Akayena nje noma iyiphi i-hacker; uyinganekwane, ungqondongqondo wezinga eliphezulu owaziwa kuphela ngelikaLizard -the-Wizard.


Ngokombono wakhe, lokhu akukhona nje ubuchwepheshe noma ikhodi — kumayelana namandla, ukulawula, futhi mhlawumbe nokuthinta ubuciko. Kuye, ama-rootkits awawona nje amathuluzi; ziwumsebenzi wobuciko, indlela yakhe yokubumba kabusha umhlaba wedijithali.


Ngakho-ke, ngaphandle kokuchitha isikhathi, ake ngikwethule endodeni ngokwayo - Lizard-the-Wizard, ngamazwi ayo:

Wonke Amaciko Adinga I-Muse: I-Old Masters of Rootkits

I-Lizard-the-Wizard Ikhuluma Ngamaphupho: Imisebenzi Yami Yobuciko


“Awu, uselapha. Ngazibuza ukuthi kuzokuthatha isikhathi esingakanani wena Benicio ukubona ukuthi udlalela ezandleni zami. Nakuba ubuthandeka kakhulu nge-Rust yakho encane kanye namanethi ayo okuphepha , bengisebenzela kokuthile okungaphezulu kakhulu… okuhle kakhulu.”


“Kuhle. Lelo yigama okungenzeka awulihlobanisi nohlelo olungayilungele ikhompuyutha, kodwa yingoba ubambeke kakhulu ekuvikeleni amasistimu akho amancane ukuze ujabulele ubuciko obusemuva kokuhlasela. Yebo, ubuciko. Ucabanga ukuthi ngiyi-hacker nje? Cha, cha — ngingumakhi, umdali. Wonke ama-rootkit engake ngawafunda abe yi-brushstroke esithombeni esihle engisidweba ku-canvas yesiphithiphithi.”


Lapha Abalingiswa Ababili Abayinhloko beNdaba yethu: i-Cplusser (Lizard-the-WizardI) vs the Rustacean (Benicio)


I-Lizard-the-Wizard iyaqhubeka:

“Uyazi, ngisho nezingwazi - uDa Vinci, uVan Gogh, uBach - bonke bafunda kumakhosi angaphambi kwabo. Mina? Ngangine -Hacker Defender kanye ne-Rustock . I-Hacker Defender kwakuyi-Houdini yami, ingibonisa indlela yokufaka ikhodi kumasistimu, okwenza amafayela nezinqubo zinyamalale njengomlingo. Futhi uRustock? Leso bekuyisikhathi sami se-Picasso - i-polymorphism esezingeni eliphezulu kakhulu, eguquguqukayo njalo, eguqukayo, eshintshayo njengomdwebo oguqukayo njalo uma uwubuka. "


"Kodwa labo? Babengamatshe okunyathela engangikwazi ukuthi ngingakudala. Kwabe sekufika i -Alureon . Ayihlalanga nje ohlelweni — yaqoshwa phakathi, yashaya i-Master Boot Record (MBR). Lona umkhakha wokuqala we-hard drive yakho, ingxenye etshela i-OS yakho ukuthi ungaqala kanjani ukuqala. Uyazi ukuthi lolo hlobo lokulawula luzwakala kanjani, Benicio? Okwaphezulu. Kufana nokuzwa Ikhonsathi Yesibili ka-Rachmaninoff okokuqala ngqa. Ubuhle obumsulwa, kepha bubhalwe ngekhodi."


“Futhi noma kunjalo, nganginganelisekile. I-ZeroAccess bekuyi-symphony yami. Yakha ibutho, yashintsha imishini yaba ibhonethi yontanga kuya kontanga, zonke izinhlelo ezingenwe yileli gciwane zidlala indima yazo emsebenzini wobuciko obuyisiphithiphithi. Kwakungaseyona nje isifo esisodwa; bekumayelana nokwenza isiphithiphithi kunethiwekhi. Yilapho usilela khona, Benicio. Usamile ukujaha ukuvumelana kukaRust, kuyilapho ubuciko bangempela busekungazini kahle - isiphithiphithi esiza ubuciko obuhle."



Ama-infection vectors kanye nama-rootkits angabangani abakhulu


“Ekugcineni kwafika i-LoJax ne -MoonBounce . Lawa bekungewona ama-rootkits kuphela - bekuyizinto eziphilayo, ephusha imingcele yokuthi kungaba yini uhlelo olungayilungele ikhompyutha. I-LoJax, eshumekwe ekujuleni kwe-UEFI, amasistimu alawulwayo asezingeni ngisho noRust wakho omthandayo akakwazanga ukuthinta. I-MoonBounce iqhubekile nayo, yangena kwimemori ye-flash ye-SPI, icasha lapho kungekho-antivirus noma ukusula uhlelo okungake kufinyelele khona. Ayizange ivele icashe ohlelweni - yaba yingxenye ye-hardware, ehlala njalo futhi engathinteki, njenge-fresco kaMichelangelo efakwe ku-silicon. "


“Kulapho ngaliqonda khona iqiniso langempela: ukulawula akukho ku-CPU noma ku-OS. Ukulawula kwangempela kuse-hardware. Futhi yilapho engakha khona imisebenzi yami yobuciko.”


" Faka i-Lizard-Blue kanye ne-Lizard-Red - i-Sistine Chapel yami yama-rootkits. Uyazi ukuthi bazalwa kanjani, Benicio? Ngizokutshela, ngoba udinga ukuqonda ubuhlakani obukudlile.”


“I-Lizard-Blue yakhiwe inakho engqondweni. Wena, uyaziqhenya nge-Rust yakho ngeziqinisekiso zayo zokuphepha. I-Lizard-Blue idanse emabhulokhini akho angaphephile, yafaka uchungechunge lwakho oluningi esiphithiphithini, yaphazamisa amasistimu akho e-I/O - konke ukukuphazamisa. Kwakungumlingani wesiwula: elula futhi enhle. Ngenkathi ulwela ukuxosha uLizard-Blue, umsebenzi wami wobuciko wangempela, uLizard-Red, wawusuvele unezimpande. "


Kodwa uLizard-Red wayengenandaba ne-CPU noma isofthiwe yakho . Cha, iqonde ngqo kumemori ye-flash ye-SPI, yangena phakathi kwezilawuli zakho ze-DMA, futhi buthule yabhala kabusha isistimu yakho kusukela ngaphakathi nangaphandle. Njenge-symphony efihliwe, idlale ku-firmware engabonakali, ebhala kabusha, engavimbeki. ”


“Lokhu ukulawula kwangempela, Benicio. Ngenkathi umatasatasa isoftware, ngakwazi kahle ihadiwe. Ngitshele, kungani ushiye i-C++ ngenxa yeRust? Ukugqwala… kuyathembisa, kuphephe kakhulu. Kodwa khumbula, Benicio, amandla eqiniso awaveli ekuphepheni. Ivela ekulawuleni. Futhi manje, awusoze wakukhohlwa lokho.”


Ukucima kukagesi kokuqala kusabalala kusukela emaphethelweni kuya phakathi nendawo ngemva kokusethwa kabusha kwegridi ehlakaniphile.

Inkundla isimisiwe. Umdonsiswano phakathi kwenkosi yezinga eliphezulu u-C++ nebutho lamambuka e-C++ aphendukele ku-Rust usuzogqashuka e-LuxCity - noma okubi nakakhulu, uyifake ebumnyameni. Izigxobo? Ukulawula okuphelele - hhayi nje ikhodi, kodwa ingqalasizinda egcina leli dolobha elikhulu liphila.


Idolobha, eligcwele amandla, selizoba inkundla yempi. U-Benicio, oqiniswe izivikelo zakhe ezisebenza ngoRust, ubhekene nenselelo angakaze ayibone iza - inselelo eyaklanywa umnikazi we-C++ uqobo, uLizard-the-Wizard, ozimisele ukubuyisela lawa ma-Rustaceans angamambuka esibayeni. Amandla amabili, amafilosofi amabili, endleleni yokushayisana . Kodwa lokhu akukhona nje mayelana nezilimi zokuhlela - kulwela ukulawula amasistimu, amandla, futhi mhlawumbe, mhlawumbe, ikusasa lezinhlelo, maye!


I-LuxCity bekungelona nje idolobha elikhulu - bekuwuphawu lokuthi ikusasa lingabukeka kanjani. Imigwaqo yakhona yayikhala ngezimoto ezizimele, futhi isibhakabhaka sasigcwele ama-drones ahlakaniphile aqondisa izimoto ezivela phezulu. Kodwa ngaphansi kwayo yonke leyo nqubekelaphambili kukhona igazi langempela ledolobha: igridi ehlakaniphile - uhlelo oluyinkimbinkimbi, olulukwe ngokuyinkimbinkimbi olwalugcina yonke into isebenza kahle.


Egunjini lokulawula eliphezulu ngaphezu kwedolobha, u-Alice no-Bob, omakadebona begridi, bagqolozele isiphithiphithi esasenzeka kubaqaphi babo. Ukucima kukagesi kokuqala kubonakale kuyiphutha elincane - into ababengakwazi ukuyiphatha. Kodwa yasakazeka, isigodi ngesifunda ingena ebumnyameni. Amandla alokoza ngokungalawuleki, futhi ngokuqalisa kabusha ngakunye, izinto zaba zimbi kakhulu. Kwakhala ama-alamu, futhi abaqaphi bakhanyisa izixwayiso zenkinga ejulile, ecashile okwakusafanele bayidalule.

Babedinga usizo. Babemdinga uBenicio.

U-Benicio: Ummeli Wokugqwala Osengozini

U-Benicio: Ummeli Wokugqwala Osengozini


Lapho uBenicio efika, wayengahlomile nje nge-laptop yakhe; Hhayi-ke, wayephethe okuthile okuyigugu kakhulu: inkolelo yakhe engenakunyakaziswa kuRust - ulimi ayelukhulumele kanzima iminyaka emihlanu edlule. Kwaba ngoRust lapho yena nethimba lakhe lonjiniyela bakwaRustacean bakha umnyombo weLuxCity SmartGrid. Ukugqwala kwakuyinkemba yakhe, isihlangu sakhe, ithoyizi elisha elicwebezelayo elathembisa ukumsindisa ezingozini ezesabekayo ze-C++ - ukuchichima kwe-buffer, izimo zomjaho, i-Use-After-Free ehlala isabeka. Ukugqwala kwakuyimpendulo yakho konke, akunjalo? Ikusasa, noma kunjalo wayekholelwa. Phela, igridi yakwaLuxCity yakhiwe phezu kwalesi sisekelo okuthiwa asinakuphuka.


Kodwa indida? Lokho ukuzethemba okungantengantengi kwase kuzohlolwa, futhi mhlawumbe - mhlawumbe - i-C++ yayingaphelelwa yisikhathi njengoba u-Benicio ayecabanga.


Njengoba u-Benicio ejuba emnyombweni wesistimu, ngokushesha wayazi ukuthi kukhona okungalungile. Ngakho konke ukusetha kabusha kwesistimu yokulawula ye-SmartGrid, ukucima kukagesi kwasabalala nakakhulu - kuqhubekela ngaphakathi kusuka emaphethelweni edolobha kuya enhliziyweni ye-LuxCity. Kwakungahleliwe; kwakungamabomu, iphethini eyenzeka phambi kwamehlo akhe, ukuhlasela okudidiyelwe kahle nokubalwa. Inhliziyo yakhe ibuhlungu. Lokhu kwakungeyona nje i-glitch - kwakuyi-rootkit, ephilayo futhi eguqukayo.


Isignesha yayicacile.


KwakunguJanus, owaziwa ngelikaLizard-the-Wizard — umngane kaBenicio wakudala waphenduka isitha. Kanye, babebhala ikhodi ndawonye, bahlole amathuba angenamkhawulo we-C++. Kodwa uJanus wayewaklolodele amanetha okuphepha aqinile kaRust kanye nezinto ezifushanisayo. Manje, u-Janus usebenzise amandla aluhlaza, angashintshiwe e-C++, ekhohlisa ingqalasizinda yedolobha njengompetha wopopayi, eqondise kubo kanye ubuchopho nesibindi se-SmartGrid enkulu kunazo zonke - efakwe ikhodi ngu-Benicio ku-Rust.


I-Lizard-Red: Ukuhlasela Okunonya Ezisekelweni

Ukuhlasela Okunonya kukaJanus aka Lizard-the-Wizard


Ngaphansi kakhulu kwe-LuxCity, ekukhanyeni okufiphele kwamarekhi eseva anyakaza ngokuphila, u-Janus wabuka umsebenzi wakhe wobuciko uqhubeka. Iminwe yakhe yayihamba ngokushesha phezu kwekhibhodi, amehlo ebukhali futhi egxilile njengoba elandelela isiphithiphithi esasivela ezikrinini ezicwayizayo. Izinto zakhe ezimbili ezinhle kakhulu azidalile bezidlalwa: I-Lizard-Red kanye ne-Lizard-Blue , ngayinye ihlasela ezindaweni ezihlukene nokho isebenza ngokuzwana okuphelele.


I-Lizard-Red yayisivele ijule phakathi kohlaka lwegridi yedolobha - umhlaseli othule ophelele. Lokhu bekungelona uhlelo olungayilungele ikhompuyutha olujwayelekile olushaya amaphuzu abuthakathaka esofthiwe. Cha, i-Lizard-Red bekuyi-rootkit ye-firmware, eqondise izisekelo ezijulile: izilawuli ze-DMA, imemori ye-flash ye-SPI, nezibambi eziphazamisayo . Yashibilika kusistimu ingabonakali, yashibilika ngaphansi kwezindlela zokuphepha eziklanywe ngobunono zikaRust. Kungani uzihlupha ngokuhlasela i-CPU noma izigcinalwazi zememori? I-Lizard-Red yazidlula ngokuphelele, yazifaka ku-firmware lapho iziqinisekiso zikaRust zingabambeki khona.


U-Janus wayeyazi imikhawulo yokuphepha okufanele kukaRust njengokungemuva kwesandla sakhe - wayechithe iminyaka eyihlinza. Ukugqwala, kukho konke ubuhlakani bayo, kuma kancane uma kukhulunywa ngongqimba lwehadiwe . Kulapho kwachuma khona uNtulikazi. Lokhu kwakungekhona nje ukuhlasela ikhodi; kwakuwukuthatha okunobutha kwehardware ngokwayo.


Ngaleso sikhathi, uLizard-Blue ubedala umonakalo ohlangothini lwesoftware olusezingeni eliphezulu . Ayizange ihlasele ngokuqondile kodwa yenza njenge-decoy ephelele, ixhaphaza amabhulokhi angaphephile kaRust njenge-maestro eqhuba i-symphony yesiphithiphithi. Iqondise izinsizakalo zokufundwa kwezinhlamvu eziningi, yasonta imisebenzi ye-I/O, futhi yadala umonakalo ngokuphoqelela izimo zomjaho uRust ayezikhulule ngokuqapha ngenxa yezizathu zokusebenza. Lezo zindawo ezingaphephile zazifana neminyango eshiywe ivulekile kuzivikelo ezakhiwe ngokucophelela zika-Benicio, futhi u-Janus - ekubeni umpetha wangaphambili we-C++ - wayazi kahle ukuthi ayivula kanjani. Imodeli yokuphepha kaRust, into enikeze uBenicio ukuzethemba, yaba ukuwa kwakhe njengoba uLizard-Blue eguqule lezo ziqinisekiso zaba ubuthakathaka.


UJanus, esendaweni yakhe ecashile, wamamatheka. Ukholo lukaBenicio kuRust lwaluzowohloka. Lokhu kwakungekona nje ukuhlasela kwezobuchwepheshe; kwakuyisifundo sobuciko bokulawula.


U-Benicio Uhlasela Emuva: Ukuveza Amaphutha KaRust

U-Benicio Ugalela Emuva


Egunjini lokulawula, uBenicio walwa ngesibindi, iminwe yakhe ihamba ngokushesha kunemicabango yakhe. Ukushaya kokhiye ngakunye kwakuzwakala njengokushaya kwenhliziyo - okuqinile kodwa kuphelelwe ithemba - njengoba ebambene nezinethi eziqinile zokuphepha zikaRust ngokumelene nesiphithiphithi esingapheli esilukwe ikhodi kaLizard-the-Wizard. U-Benicio wayeyingcweti emodeli yokuphepha kaRust, eqiniseka ngokuvikeleka kwayo, kodwa uLizard-Blue wadabula i-CPU ngokunemba kokuhlinzwa. Izimo zomjaho kanye nokwehluleka kwe-I/O kuqubuke ezikrinini zonkana. Ngaso sonke isikhathi lapho u-Benicio ecabanga ukuthi unesandla esiphezulu, ukuhlasela kwashintsha - ukushintsha isimo, izivikelo ezidlule njengethunzi elingena ngaphansi komnyango.


Ukugqwala akukwazanga ukuqhubeka. Yona kanye into uBenicio ake ayithanda ngoRust - inethi yayo yokuphepha eqinile - manje yayisiklinya amandla akhe okuphinda akwazi ukulawula. Zonke izivikelo zaba yikheji, zanciphisa ukunyakaza kwakhe, zamvalela endaweni engapheli yeziqeshana zokuzivikela ezahluleka ngokumelene nokuhlasela okuwuketshezi, okungaphezi.


Kodwa uBenicio, osemnkantshubomvu kwezobuciko bempi, wayazi ukuthi lokhu kwakuwumdlalo nje.


Usongo lwangempela bekungekhona ukudansa kukaLizard-Blue kumamonitha. Kude ngaphansi komhlaba, ekujuleni emithanjeni yegridi ehlakaniphile yakwaLuxCity, uLizard-Red wayesewuthathile amandla okulawula. Yayingasadlali ezindaweni ezingaphezulu zokuzivikela zikaRust. Yayingene yajula, isebenzisa izifakelo ze-firmware ukuze ingene ezinhlelweni ezibucayi njenge-SCADA kanye nezinhlelo ze-HVAC ezazilawula ingqalasizinda yedolobha kuze kufike emnyombweni wayo. Lawa bekungamasistimu lapho i-Hardware yahlangana khona nesoftware - lapho iningi lamadivayisi okugcina nokulawula asebenza nge-firmware yangokwezifiso, iningi lakhona lisaxhaswe yifa le-C kanye ne-Assembly.


Izilawuli ze-DMA kanye nememori ye-flash ye-SPI ifakwe engcupheni. I-Lizard-Red yayidlule i-CPU ngokuphelele , yazishumeka ku-hardware engaphansi kwe-OS. Ibiqondise empilweni yengqalasizinda - izinhlelo ze-SCADA ezilawula ukusebenza okubalulekile kanye nezinhlelo ze-HVAC eziqinisekisa ukuthi i-hardware yedolobha isebenza ngaphandle komthungo. Lezi zimila kwakungeyona nje ikhodi elula - zazihlala unomphela, zatshalwa ngokuhlinzwa ku-firmware, zibhala kabusha imithetho yohlelo kusukela ngaphakathi ngaphandle.


Imodeli yenkumbulo kaRust - eyakhelwe ukuvikela isoftware - yayingasho lutho lapha. Lena kwakuyimpi yezinga le-firmware, lapho izivikelo zikaRust zazifana nodonga lwenqaba olwakhiwe kahle, kodwa abahlaseli base bengaphakathi kwamasango, besebenzisa i-hardware ngokuqondile.

UJanus wayenze lokho abambalwa ababengakwenza: wasebenzisa izindawo ezibuthakathaka ku-hardware - zona kanye izindawo iRust engazange yakhelwe ukuvikela. Izindawo lapho kuphela insimbi engenalutho, i-C++, ne-Assembly ibusa phezulu. U-Benicio wayengenakuqhathaniswa, futhi ekujuleni, wayekwazi.


I-Melodramatic Turn: Inkinga Ka-Benicio Yokholo

I-WTF ?


U-Benicio ushaye isibhakela sakhe ku-console. Ukugqwala bekuyisisho sakhe esingcwele, ulimi ayeluthemba ukuthi luzovikela zona kanye lezi zinxushunxushu ezisongela ukugubuzela iLuxCity. Wayekholelwa esithembisweni sayo sokusula zonke izigaba zobuthakathaka. Kodwa manje, njengoba idolobha lizamazama onqenqemeni lokuwa, wafikelwa umuzwa obandayo: Ukugqwala kwakunganele.


Wagqolozela isikrini esikhazimulayo, amehlo akhe ebheke kufolda endala ebekwe kudeskithophu yakhe ebhalwe ukuthi “Old C++ Tools.” Iminyaka emihlanu - kwase kuphele iminyaka emihlanu agcina ukuthinta noma yini kuleyo folda. Wayefungile ukuthi ngeke abuyele emuva. Wayengeke adinge. Ukugqwala bekukade kuyikusasa, ukuphunyuka kwakhe ezingozini nokuntengantenga kwe-C++. Kepha manje, njengoba izibani zedolobha zicwayiza ngayinye ngayinye, wayazi ukuthi ukuqina kweRust - ukuphepha okwake kwaba yisihlangu sakhe - kwase kuphenduke ikheji. Kwakunzima kakhulu ukuphendula kulolu hlobo losongo.


Ukuhlaselwa kwe-LuxCity bekungapheli, futhi bekungeyona nje eyedijithali - bebeshaya i-hardware, ukujula kwezinga le-firmware lapho uRust engakwazi ukunyathela khona. Wayelazi iqiniso manje: le mpi yayingekhona nje mayelana nokuRust ngokumelene no-C++. Lokhu kwakumayelana namandla. Futhi C++? I-C++ yayinamandla aluhlaza, angashintshiwe okufinyelela lapho uRust ayengakwazi khona, ekujuleni kwe-firmware lapho uLizard-Red wayezishumekele khona.


Isandla sakhe santanta phezu kwegundane, siqhaqhazela. Ukuvula leyo folda kuzwakale njengokufinyelela isikhali sakudala, esiyingozi - esikwazi ukulimaza ngendlela enhle ngayo. Ukunyakaza okukodwa okungalungile, futhi i-LuxCity izobe ingasekho unomphela. Kodwa ngaphandle kwayo, ngaphandle kwezinxushunxushu namandla anonya e-C++, ibingekho indlela yokuzilwela.


Ngenhliziyo ebuhlungu, u-Benicio uchofoze ifolda. Umbono ojwayelekile wamathuluzi akhe amadala wambingelela, futhi ngaleso sikhathi, wayazi - le mpi ngeke iyinqobe ngokuphepha nangokuqapha. Kungathatha ingozi.


Ulayini Wokuphila Ongalindelwe Ka-Janus: Ukusonta Empini

Njengoba idolobha liqhubeka lingena esiphithiphithini futhi i-SmartGrid isondela onqenqemeni lokuwa, isaziso sacwayiza esikrinini sika-Benicio. Kwakuvela kuJanus . Inhliziyo ka-Benicio yeqa - yini manje? Kodwa esikhundleni sesiphithiphithi esikhulu, lo myalezo wawubalulekile. U-Janus ubengekho ukuze acekele phansi i-LuxCity ngokuphelele - hhayi okwamanje. Wayefinyelele okuthile ayengakulindele: uhlu. Ukuhlukaniswa okuningiliziwe kwayo yonke isevisi eyonakele, yonke inqubo eyonakalisiwe, futhi - okubaluleke kakhulu - amakhodi wokuwalandelela.


U-Benicio wangabaza, engaqiniseki ukuthi uzomethemba yini umngane wakhe wakudala owaphenduka isitha. Kodwa sasingekho isikhathi sokungabaza. Njengoba ikusasa le-LuxCity lilenga esilinganisweni, wayengenakho enye indlela ngaphandle kokwamukela usizo. Isandla sakhe sazungeza phezu kwegundane isikhashana ngaphambi kokuthi achofoze avule ifayela eliqukethe amathuluzi akhe amadala e-C++.

Ukuhlengwa kuka-Benicio: Amandla e-C++

Izinsizwa ezindala futhi?


Ngezandla eziqhaqhazelayo, uBenicio waqala ukuthayipha. I-syntax eyake yajwayeleka ye-C++ yageleza kuye njengemvelo yesibili, inkumbulo yemisipha yeminyaka iqala ukukhahlela. Waqala ukwenza izindlela zokuphikisa, ezihlanganisa nengqalasizinda kaRust, exhuma ku-firmware ukuze avale isiphithiphithi u-Janus ayededele. Isakhiwo sikaRust esiqinile sasimshiye engenamandla okumelana nokuhlasela kwezinga le-firmware, kodwa u-C++ kwakuyinkemba nesihlangu sakhe manje. Weqa amanetha okuphepha kaRust, wangena waqonda ngqo ku-hardware esengozini, ehlanganisa izicelo ze-DMA kanye nenkohlakalo yememori ye-SPI ngayinye ngayinye.


Umoya egunjini lokulawula wawushubile. U-Alice no-Bob babukele, amehlo abo elokoza phakathi kwezibani ezifiphalayo kugridi kanye nemigqa yekhodi egcwele isikrini sika-Benicio. Isikhathi sase siphela.


Ngokucindezela ukhiye ngakunye, u-Benicio wayesebenzisa amandla e-C++ yesimanje, eqondiswa imikhondo u-Janus, umnikazi wemibala emibili yezibankwa, ayewanikezile - amakhodi kanye nemephu yomgwaqo yezinsizakalo ezisengozini. Lena bekungeyona i-C++ yakudala eyingozi, enesiphithiphithi. I-C++ yesimanje yayilawule eziningi zalezo zingozi: izikhombi ezihlakaniphile, ama-flavour amaningi kunangaphambili, namamodeli obunikazi anenela izici zokuphepha zikaRust kodwa anokuguquguquka okwengeziwe, amandla aluhlaza. Kwacwengisiswa, kwavela. Kodwa noma kunjalo, yonke imigqa yayinesisindo. Isinyathelo esisodwa esingalungile singase sisho inhlekelele. Nokho, njengoba esebenza, u-Benicio wayekwazi ukuzwa izingxenye zegridi zilulama, uhlelo lusabela ekunembeni kwe-C++ yesimanje.


U-Janus wayelayishile i-fuse, kodwa manje wayesenikeze u-Benicio amakhodi okuphika . Ukuthi noma kwakuyisenzo sokuhlenga noma umnyakazo wokuzazisa ukuze afakazele ukubusa kwakhe ekupheleni komdlalo, akubanga nandaba, kucabanga uBenicio. Manje wayesebhala ngekhodi impilo yedolobha, izipoki ze-C++ zindanda phezu kwazo zonke izinqumo.


Zonke izingcingo zomcimbi, yonke ibhulogi yomhlangano oshumekiwe, kwakuwumdanso oyinkimbinkimbi onqenqemeni lwenhlekelele. Kodwa ikhodi engaphephile isongwe nge-C++ yesimanje, kusetshenziswa izakhiwo ezikhumbuza ama-monads - into u-Janus ayeqinisekise u-Benicio ukuthi ayisebenzise, uma kubhekwa ukuthi u-Benicio wayengamjwayele u-Haskell . Njengoba imizuzu ihamba, isiphithiphithi kuma-monitor saqala ukuhamba kancane.


Umqondo ka-Benicio awukwazanga ukunyakazisa amazwi ahlabayo: Ukugqwala bekuyinetha lakhe lokuphepha. Kodwa-ke, kulo mzuzu, i-C++ kuphela ebinamandla okuguquguquka kanye namandla aluhlaza okudonsa i-LuxCity isuke onqenqemeni. Njengoba ebhala amakhodi ngokucasuka, ukubhaca insiza ngayinye uJanus yonakalise, kwacaca into eyodwa - kwakungekho ulimi oluphelele, ithuluzi elilungile kuphela lempi efanele.


Ngaleso sikhathi, u-Benicio wayengagcini ngokubhala ikhodi ukuze asindise i-LuxCity; wayehamba umugqa omuhle phakathi kwendalo nokubhujiswa, eqondiswa yilona kanye ulimi ayefunge ukuthi ngeke aphinde aluthinte.


Isifundo Sokugcina: I-Rust's Safety vs. C++'s Mastery of Control

Njengoba u-Benicio ebambana nezinhlelo ezintekenteke ze-LuxCity, isisindo sangaleso sikhathi samshaya kaningi: URust, ulimi ayelunqobe, lwalubhidlika ngaphansi kwengcindezi yomhlaba wangempela. Iziqinisekiso zayo zokuphepha - izindonga eziduduzayo ayethembele kuzo - zase ziyikheji lakhe. UJanus, uLizard-the-Wizard, usebenzise yonke imingcele eqinile ebekwe nguRust - yonke ibhulogi engaphephile yaba umnyango wesiphithiphithi, yonke imodeli yenkumbulo evikelekile isithiyo u-Benicio ayengakwazi ukusinqoba ngesikhathi. I-Rust, emzamweni wayo wokugada yonke into, yayishiye ingqalasizinda yedolobha ivezwe ekuhlaselweni okwedlulele ngale kwesoftware, yafinyelela ekujuleni kwehadiwe uqobo.


Khona-ke iqiniso lamshaya uBenicio njengokuthonywa kwamathumbu: Ukugqwala kwakungehluleki ngoba kwakubuthakathaka. Yayihluleka ngoba yayiqine kakhulu, iqine kakhulu, ingakwazi ukuzivumelanisa namandla ayengalindelekile ayededelwe nguJanus. Kodwa u-C++, ulimi ayefunge ukuthi uzolushiya - nawo wonke amandla alo ayingozi nokuguquguquka okuxakile - kwakuyisona sikhali esikwazi ukubuyisela ibhalansi. I-C++ bekungelona nje ithuluzi; kwakuyinkululeko, isimemo sokucwila endaweni engaziwa, ukulawula okungalawuleki.


Ngehedisethi, izwi likaJanus lanqamula ukuthula. Kodwa kulokhu, kwakungekhona ukugcona noma ubutha.


"Uyayibona manje, angithi?" wabuza, ngokunemba okuzolile kwe-maestro eyayihlele wonke umsebenzi. Lokhu bekungakhulunywa ngezilimi, Benicio. Imayelana nokwenza kahle uhlelo - zonke izendlalelo, zonke izimfa - kusukela kusofthiwe kuya ku-hardware, kusukela kungqondongqondo kuya kuzibalo ezisenhliziyweni yegridi yethu yokuhlela.


UJanus ubengasanda kuhlasela iLuxCity. Wayephushe u-Benicio onqenqemeni ukuze amfundise isifundo kuphela isigebengu esihlakaniphile esingasiletha: amandla eqiniso awabheki ekukhetheni ulimi 'oluphephe kakhulu', kodwa ekuphatheni kahle izakhiwo ezingaphansi kwalo, ekugobiseni imithetho lapho kudingeka ukuzivumelanisa nezimo sinda.


“Angikaze ngifune ukucekela phansi i-LuxCity,” kuqhuba uJanus, izwi lakhe licishe libe muncu. Bengifuna ukukukhombisa ukuthi ukuthembela ekuvikelekeni njengeRust kukwenza ukwazi ukubikezelwa. Uzibonele wena - Ukugqwala kuboshelwe yimithetho yakhona. C++… C++ ikuvumela ukuthi udale imithetho. Okuwukuphela kwezithiyo engizihloniphayo yilezo ezibekwe ngomusa nangobuhle nge-algebra engabonakali, ithiyori yesigaba, namalensi e-dominating-graph theory .”


Njengoba idolobha lizamazama onqenqemeni lokuwa, uBenicio wayeseqonda manje. U-Janus wayehlele ukuhlasela hhayi ngenxa yonya, kodwa njengesivivinyo - isifundo sokulawula, ukubamba kahle, nokuzivumelanisa nezimo. Indida? Ukuze anqobe uJanus, uBenicio kwadingeka amukele lona kanye ulimi ayelufulathele.


Nalu uhlu lokugcina lwezinsiza ezisengozini ,” kusho u-Janus, enikeza u-Benicio ucezu lokugcina lwendida. Kwase kuyisikhathi sokuqeda lokhu, kodwa manje base besebenza ndawonye - inkosi nomfundi, njengezikhathi zakudala.


Njengoba u-Benicio ejuba ebuyela kukhodi, ingqondo yakhe yakudala ye-C++ yabusa. Ngokuqondisa kuka-Janus, waqondisa amakhodi okugcina e-malware eqhubekayo ngayinye ngayinye, eshumeka umhlangano lapho kudingeka khona, weqa imikhawulo kaRust, futhi ehlehlisa umonakalo ezingeni le-firmware. Yayingeyona inhle njalo, futhi yayingaphephile ngaso sonke isikhathi, kodwa yayisebenza.


Umoya osegunjini lokulawula ushintshile. U-Alice noBob, nakuba babeshubile, babuka njengoba isimiso siqala ukuzinza kancane kancane. Amandla aphindela emuva emaphethelweni edolobha. I-SmartGrid, inhliziyo eshayayo ye-LuxCity, ekugcineni ibizilwela.


UBenicio wayefunde kabuhlungu ukuthi alukho ulimi, kungakhathaliseki ukuthi 'luphephe kangakanani,' olwalungaqinisekisa ukulawula lapho ebhekene nenselele yangempela. Ekugcineni, kwakungekhona ngokukhetha i-Rust noma i-C++; kwakumayelana nokubamba kahle kokubili, ukuqonda ukuthi impi yangempela ayikho emigqeni yekhodi, kodwa isengqondweni nasesayensini yomhleli oyisebenzisayo .



Ingabe ufuna ukufinyelela izindatshana ezengeziwe nezindaba ezihlobene nalesi sihloko?


Ungalandela umsebenzi wami futhi ubhalisele incwadi yami yezindaba ukuze uthole izibuyekezo, imininingwane, nokuqukethwe okukhethekile:


Hlala uxhumekile ukuze uthole imininingwane eyengeziwe yezobuchwepheshe nezindaba!