From nobody Thu Sep 12 07:52:17 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X48mZ2lkKz5VBc5 for ; Thu, 12 Sep 2024 07:52:30 +0000 (UTC) (envelope-from theraven@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X48mZ0WQwz4X9m; Thu, 12 Sep 2024 07:52:30 +0000 (UTC) (envelope-from theraven@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726127550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U34eoPgXK+aDj/QJRTLGJpudvw02/KMEh41Xg2oO1cQ=; b=gb8NNXF8z2n/Cp5adiDth/mn1jbMYUO2osaBt6UQubl8cR51QiKrFOxmd0M5+WTICcdUtP mapKq8roX/9TtrEXPHPQnR2t05l3s6o0rArZxEXO+XPP8ce4w9edaaqNQKRCgKwQ7WC3TL 9eRMuf36Aw0vR62iBE97Qvj4P/XcvJpYaaHIAa2lNvxkv+Z26y9wVGMUDOTBVvJ99US+9Z MmYTlLKp+Kebx1ndnmEAI+nbZ/s3IoK0/aQabRxPsQd/etItlYe2HdPJxPzvDr9sGdNFaO iiIydwIBeWOalo8q93Cq4LWndgdnhFb9ZxRaBXBAyIG9yBNRnZLG/+jFqgdJDQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726127550; a=rsa-sha256; cv=none; b=JC/foBBoJbV1pQzWUU5hwhld8ufT3Ix+aEkA7yBVVTVSsDSsFlca3Hc0Kx63P2k7db2Vai yrg3QsMJfDxQeFhlfd5AJuY8HyZgW6XYjHsHnFdJU8mqqa2d4k1yBOyT9uYDyyMOvPNygh fEI/bNUfdjE0A2pa7V5u+FJkFx6vPIqB0saAXCgHo+6WJ9Nv0HZbk9YHkmA1uQ63Kaf5q+ Wf/hkSbby+YU38V5lcneEShAPOvu9794pQnWZc/RlBwGr/imefQg3FFy25aS+MM0DO9575 gDCfMJOWbsMpycRKiHY7+eP2kJQ6ejZD29YPgW8Wt7KLBi5xnGF23XdRp1U3IQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726127550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U34eoPgXK+aDj/QJRTLGJpudvw02/KMEh41Xg2oO1cQ=; b=pX3pH3qZssS9zRvSf3Ayx16XaujJz10Fxjy1U/N8T/F1BGSw5tIKmwcADIscGgfz6xrH8f SXaXDK5+YcSvQa0H3bnggXBdU8nZYZHsQxrXIA9X3O/u2kq7oyqBJNlgaJ34P+IXkLuAoh M8spIjPKXRGqBrF69P2jKQT+L/TBo0zyhNoZ3afkt1M4pfXXKHp+SnvAveA6icv9BhvkT5 5qCxTyOpW2aaAVWnbcSi3TmIWadl87YTF5V0FqOrINAnGjqPNtDuMLYw3MD/NLfi9hJiCu NCk+i/Qa3L6PIW8dTvU1lZDxMjATihDNgtOItYQgErwT9D0vOZTnKN8Zeb2X7A== Received: from smtp.theravensnest.org (smtp.theravensnest.org [45.77.103.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: theraven) by smtp.freebsd.org (Postfix) with ESMTPSA id 4X48mZ04xFzLDD; Thu, 12 Sep 2024 07:52:29 +0000 (UTC) (envelope-from theraven@freebsd.org) Received: from smtpclient.apple (host109-155-136-107.range109-155.btcentralplus.com [109.155.136.107]) by smtp.theravensnest.org (Postfix) with ESMTPSA id 0DA3765FE; Thu, 12 Sep 2024 08:52:29 +0100 (BST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: David Chisnall List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org Mime-Version: 1.0 (1.0) Subject: Re: The Case for Rust (in any system) Date: Thu, 12 Sep 2024 08:52:17 +0100 Message-Id: References: Cc: Chris , Warner Losh , FreeBSD Hackers In-Reply-To: To: Alan Somers X-Mailer: iPad Mail (21G93) On 12 Sep 2024, at 00:14, Alan Somers wrote: >=20 > "Memory safety =3D=3D restrictive training wheels" is just a common > misconception. It=E2=80=99s worth thinking about why programming languages exist. Any moder= n language is Turing complete. In terms of what can be expressed, there is n= o difference between Rust, C, and C++. The important thing is that there is a= n infinite set of possible programs and a finite set of desirable programs. T= he goal of a programming language is to make it easier to express programs i= n the set of desirable programs than ones that are not in that set. Sometime= s this is skewed away from specific sets. The reason that we care so much about memory-safety bugs is that they allow a= n attacker to step completely outside of the abstract machine of the program= . Unless you embed an interpreter/ compiler in your program, memory-safety b= ugs are about the only way that an attacker can get arbitrary code execution= in your program. The kind of bug where an attacker provides a specially cra= fted file / blob of network data and then runs code on your machine is typic= ally the worst thing that can happen. Rust, in particular, skews towards making programs with memory-safety bugs m= uch harder to represent. You can still do it, by using unsafe or relying on u= nsoundness in the type system as cve-rs does, but you have to try hard. I consider that a desirable property in a language. I don=E2=80=99t have to t= hink about whether I=E2=80=99ve made these bugs impossible (and, remember, W= annaCry cost billions of dollars and depended on a single memory-safety bug)= , I get that for free and I can focus on other things. David