Date: Thu, 5 Sep 2024 15:20:26 -0400 From: Karl Denninger <karl@denninger.net> To: freebsd-hackers@freebsd.org Subject: Re: The Case for Rust (in any system) Message-ID: <b2c6c38c-4e14-4e3e-b6ac-3f9c13519a0f@denninger.net> In-Reply-To: <CAOtMX2iCNX5OkdeghnbmcMrO0UYWwm4zfxFSZGznOznu%2Bmh5rA@mail.gmail.com> References: <CAOtMX2iCNX5OkdeghnbmcMrO0UYWwm4zfxFSZGznOznu%2Bmh5rA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------tz2ZXe8FX0LLJVhK5fWywHIE Content-Type: multipart/mixed; boundary="------------3YLnouGggY5YYOvYFDxUunlA"; protected-headers="v1" From: Karl Denninger <karl@denninger.net> To: freebsd-hackers@freebsd.org Message-ID: <b2c6c38c-4e14-4e3e-b6ac-3f9c13519a0f@denninger.net> Subject: Re: The Case for Rust (in any system) References: <CAOtMX2iCNX5OkdeghnbmcMrO0UYWwm4zfxFSZGznOznu+mh5rA@mail.gmail.com> In-Reply-To: <CAOtMX2iCNX5OkdeghnbmcMrO0UYWwm4zfxFSZGznOznu+mh5rA@mail.gmail.com> --------------3YLnouGggY5YYOvYFDxUunlA Content-Type: multipart/alternative; boundary="------------E8Lf4W0eusc3A0g0SXJ0lQg0" --------------E8Lf4W0eusc3A0g0SXJ0lQg0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 T24gOS81LzIwMjQgMTQ6MDksIEFsYW4gU29tZXJzIHdyb3RlOg0KPiBCeSBub3cgSSBleHBl Y3QgdGhhdCBtb3N0IG9mIHlvdSBoYXZlIHNlZW4gdGhlIGxvbmcgbGlzdCBvZiBuZXcNCj4g c2VjdXJpdHkgYWR2aXNvcmllcyB0aGF0IGp1c3QgY2FtZSBvdXQuICBTdHJpa2luZ2x5LCBh bGwgd2VyZSB0aGUNCj4gcmVzdWx0IG9mIG1lbW9yeSBoYW5kbGlu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cmVxdWVudGx5IGFuZCB0aHVzIA0KaW1wb3Nl cyBzYWlkIGNvc3QgYWxsIHRoZSB0aW1lIChvciBhdCBsZWFzdCBhIHZlcnkgbGFyZ2UgYW1v dW50IG9mIHRoZSANCnRpbWUpIHRoZSBkZWJhdGUgb3ZlciAiZG8gaXQgb25jZSBhbmQgZG8g aXQgcmlnaHQsIGV2ZW4gaWYgaXQgdGFrZXMgDQpsb25nZXIgYW5kIHJlcXVpcmVzIHByb2dy YW1tZXJzIG9mIGhpZ2hlciBza2lsbCIgYXBwcm9hY2ggLnZzLiAiZG8gaXQgDQpmYXN0IGFu ZCBsZXQgdGhlIGNvbXB1dGVyIGNhdGNoIGFuZCBmaXggdGhlIHN0dXBpZGl0eSBhdCBydW50 aW1lLCANCmltcG9zaW5nIHNhaWQgY29zdCBpbiBldmVyeSBpbnN0YW5jZSB3aGV0aGVyIHN0 dXBpZGl0eSBvY2N1cnJlZCBpbiB0aGUgDQpjb2Rpbmcgb3Igbm90IiBzaG91bGQgbm90LCBp biBteSBvcGluaW9uIGFueXdheSwgZW5kIGluIHRoZSBsYXR0ZXIgZGVjaXNpb24uDQoNCi0t IA0KS2FybCBEZW5uaW5nZXINCmthcmxAZGVubmluZ2VyLm5ldA0KL1RoZSBNYXJrZXQgVGlj a2VyLw0KL1tTL01JTUUgZW5jcnlwdGVkIGVtYWlsIHByZWZlcnJlZF0vDQo= --------------E8Lf4W0eusc3A0g0SXJ0lQg0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <!DOCTYPE html> <html> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF= -8"> </head> <body> <div class=3D"moz-cite-prefix">On 9/5/2024 14:09, Alan Somers wrote:<= br> </div> <blockquote type=3D"cite" cite=3D"mid:CAOtMX2iCNX5OkdeghnbmcMrO0UYWwm4zfxFSZGznOznu+mh5rA@mail.gmai= l.com"> <pre wrap=3D"" class=3D"moz-quote-pre">By now I expect that most of= you have seen the long list of new security advisories that just came out. Strikingly, all were the result of memory handling errors. And none of them wouldn't have happened if their respective programs had been written in a memory-safe language. In fact, of all the C bug fixes that I've been involved with (as either author or reviewer) since May, about three quarters could've been avoided just by using a better language. The real takeaway here is that C is no longer sufficient for writing high quality code in the 2020s. Everyone needs to adapt their tools. Programmers who don't will increasingly come to resemble experimental archaeologists, i.e. people who learn flintknapping to "keep the knowledge alive". Such people are valuable, but definitely niche. I for one don't want my career to go in that trajectory.</pre> </blockquote> <p>I'm sorry, this is not the correct take from it.</p> <p>To argue that the answer is to put a diaper on a child so it does not drop excrement on the carpet is to forever treat said human as an infant without control of its sphincters.=C2=A0 While such an an= swer might be necessary for a short period of time in all young human creatures it also should be obvious that we are all walking around today without them and thus said prophylaxis is to cover for a deficiency rather than a necessity.</p> <p>Now if the prophylaxis had no cost it wouldn't matter so much, but it does have cost (just as do diapers) in that such languages are inherently less-efficient.=C2=A0 There is an argument for this trade-off where the "thing" is infrequently used and thus the impact small, but going this route for frequently-used applications and even worse at the OS level is how we got to a place in many application programs and operating systems where what used to run comfortably in under a gigabyte of RAM will no longer execute at all in four, and why an application (when written in "C") will handle multiple camera streams in real time with five-minute lookback buffers, has its own defensive systems against attack and denial-of-service and internal HTML-capable server on a $25 postcard-sized computer, were it to be written in such a "safe" language would also require a device with five times the CPU, RAM -- and electrical consumption due to the overhead imposed by same.</p> <p>Thus for kernel-level or system-library-level code (or for that matter execution-heavy applications) that are executed very frequently and thus imposes said cost all the time (or at least a very large amount of the time) the debate over "do it once and do it right, even if it takes longer and requires programmers of higher skill" approach .vs. "do it fast and let the computer catch and fix the stupidity at runtime, imposing said cost in every instance whether stupidity occurred in the coding or not" should not, in my opinion anyway, end in the latter decision.</p> <div class=3D"moz-signature">-- <br> Karl Denninger<br> <a href=3D"mailto:karl@denninger.net" class=3D"moz-txt-link-freetex= t">karl@denninger.net</a><br> <i>The Market Ticker</i><br> <font size=3D"-2"><i>[S/MIME encrypted email preferred]</i></font><= /div> </body> </html> --------------E8Lf4W0eusc3A0g0SXJ0lQg0-- --------------3YLnouGggY5YYOvYFDxUunlA-- --------------tz2ZXe8FX0LLJVhK5fWywHIE Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature.asc" -----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEEvWWSxnGhSYSUSaCtby3AFeuPWXgFAmbaBHsFAwAAAAAACgkQby3AFeuPWXjO qw/9GmtcB7PvPDc8RkJv6gazdC4yr4IPqiN0U3yIWaR10wYlhkKNY9zD2ohvZBZJ1xAhYBNu+XbX VRjI0oBCbBeDhKtCANVlwB7FWxXUWwSEO19sgQM1vqqGK5dVKQvzZV3YWatY6KSgAIzZj7LS4NLd g4cPyA8AnNbOLrsX0uuXGG3rkFcb9pErT9CuYvikS5+6DbxAN8lMCVhqE1lvj3pS08MsN8Q/dEmU XsIi82sFRwifB75Nty3xsdCWl413+fc2gY1H29V4wNsDyJtkqguTe4u0+x2R1uWdaDGs/vhVCehY 4qoWX6Fv1Q/kwWZ3VE4WeKX9P4Urtd/rP6m4WNbCcmFlntvfpWkPx63jVZVZMw3zWFsUIYVwlnV5 XQn9XdnU9sUBoZcBoayVQzAyvHgX9OrnfCIjHdXEK6GwB6DKoTqicaS7rWEXnV5e4iKqLhyKPHHQ STpVIxmQb7hvTrQl78speQ11Wch5x2QJ+bB1B0RtLVkAqm3f/5V8nIASnG+/ROgYNgMJag2qgiJ3 Kp0rC1P8W1I7tcW3rpOMM2DbiuWGMTIH0yRFReckCr18RXNht3IXuTPo38msZgPsFhyt9G8coJtq N2ltPxz+7H31lEQYKi2pMe9jczwT0GoKWziZfvJf7mdAHfTWuk11uhbQBLQU2TgHnWI4HmFcnveg CSQ= =VJJ7 -----END PGP SIGNATURE----- --------------tz2ZXe8FX0LLJVhK5fWywHIE--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b2c6c38c-4e14-4e3e-b6ac-3f9c13519a0f>