From nobody Wed Jul 31 14:36:54 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 4WYvn66Z9Gz5S1DV for ; Wed, 31 Jul 2024 14:36:58 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WYvn619bHz4jl4 for ; Wed, 31 Jul 2024 14:36:58 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b="RP/owPUu"; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::22a as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3db14339fb0so3901170b6e.2 for ; Wed, 31 Jul 2024 07:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; t=1722436616; x=1723041416; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=KLFu5wt1mQgkqPG58Kxgr6FnHz4NlThe4Z/YR3efNl0=; b=RP/owPUuFn9f6GVkDr0BaFfBnvtXRZP3Bo12L5fBmOdw5cVVSy9SboGL0pccP+vbGc bP4xL/zblgrfvxk4RvWvIfKt4Z26DxWbjgj3kIP6veLi3jEe4R8U3IuLcWwg8Sa0SYcx lFfK5b1g9U0wZ9v50V4cwNWVF1m1Y25+XNbhsHURN3qVGFXnbW6dAs92NaB6c00Co3zT x9hQ8Tj4nq8ybqO+UJfkeBrixhQQECyCP9a94sWFgkVh68XhDCoC1BPeyHt6APO6gvlj M/IbYO3yLwcN8fQ15mVl9GpStpS1+rLlV0kCLySRONWujUA1nGYXWkyPazsEKurOULKf UbNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722436616; x=1723041416; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KLFu5wt1mQgkqPG58Kxgr6FnHz4NlThe4Z/YR3efNl0=; b=au5izMRtzevPCqoIxmcgnwVoPrpYwZ6ZlXTHkPhrKztNqirP1CgmsYkby06pkis7cH lWRKXr7RatqzlhG7ePyY4cPDujH7QI+pCuAZAiWTguP6CFFTt17tcbJIQ/IiNMUv6FjH Kep3hnJj9E6o7NBDBhFLsaTG7U2XpfjBKAfI2XD1UizvZo1ofB7xXHGmNwnenLC2o+Ll ia74LwPX2IKuRtIXax/7ja3QJg1dlnPtlLXV40SS5j4d2d4btVRw8H8CwApAOMwsZap4 /FAlR8BqMq/FcGL1FPJumQ0PWYQOuwC8vr1cyY5P8VeY3Tl3BR1TBScKer2saE/Hgoqs U9XA== X-Gm-Message-State: AOJu0YwqBM74zOGcNhcpyXEDUjRv+5AMslnU5gjAsVqL57Bat89nR7WK bk7bJSxlZGJABGFKztmmgfOojAxSaSvssVHwcNj2rij+J46Oex7nBN/V3UWB8zc= X-Google-Smtp-Source: AGHT+IFqeFMlXAWojOkR77YthzMiQd12EzWzKKR5jF9mKoRG/M7Sy2DiK8YIZP4w+Wjq8+CK05flDA== X-Received: by 2002:a05:6808:1b22:b0:3d5:5fbe:b2fa with SMTP id 5614622812f47-3db23aa2aa6mr17312900b6e.35.1722436616382; Wed, 31 Jul 2024 07:36:56 -0700 (PDT) Received: from mutt-hbsd (174-24-87-135.clsp.qwest.net. [174.24.87.135]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db420f8085sm690849b6e.50.2024.07.31.07.36.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 07:36:55 -0700 (PDT) Date: Wed, 31 Jul 2024 14:36:54 +0000 From: Shawn Webb To: Alan Somers Cc: FreeBSD Hackers , Warner Losh , Scott Long , meka@tilda.center Subject: Re: The Case for Rust (in the base system) Message-ID: X-Operating-System: FreeBSD mutt-hbsd 15.0-CURRENT-HBSD FreeBSD 15.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: 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 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mnp5en7dxtqafvrw" Content-Disposition: inline In-Reply-To: X-Spamd-Bar: ----- X-Spamd-Result: default: False [-5.10 / 15.00]; SIGNED_PGP(-2.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.999]; MID_RHS_NOT_FQDN(0.50)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MISSING_XM_UA(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::22a:from]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DMARC_NA(0.00)[hardenedbsd.org]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DKIM_TRACE(0.00)[hardenedbsd.org:+] X-Rspamd-Queue-Id: 4WYvn619bHz4jl4 --mnp5en7dxtqafvrw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 20, 2024 at 09:51:25AM -0700, Alan Somers wrote: > In a recent thread on src-committers, we discussed the costs and > benefits of including Rust code in the FreeBSD base system. To > summarize, the cost is that it would double our build times. imp > suggested adding an additional step after buildworld for stuff that > requires an external toolchain. That would ease the build time pain. > The benefit is that some tools would become easier to write, or even > become possible. Here is a list of actual and potential Rust projects > that could benefit from being in-tree. If anybody else has items to > add, I suggest moving this into the project wiki: >=20 > Stuff that could only be written in Rust if it were in base > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > * ctl-exporter (I started this, but discovered that the CTL stats API is > unstable, so it can't live in ports. Instead, I had to do it in C). > https://github.com/freebsd/freebsd-src/commit/1a7f22d9c211f504f6c48a864= 01469181a67ec34 >=20 > * fusefs tests. Absolutely impossible to do in C. I considered Rust, bu= t went > with C++ so they could live in base. They are too closely coupled to > fusefs(5) to live out-of-tree. > https://github.com/freebsd/freebsd-src/tree/main/tests/sys/fs/fusefs >=20 > * devd. Currently C++, but imp suggested a rewrite. > https://github.com/freebsd/freebsd-src/tree/main/sbin/devd >=20 > * zfsd. Currently C++, but I've long pondered a rewrite. Using Rust wou= ld > make it more testable. > https://github.com/freebsd/freebsd-src/tree/main/cddl/usr.sbin/zfsd >=20 > * nscd. Currently C, but confusing and with no test coverage. I've > contemplated a rewrite myself, but I don't want to do it in C. > https://github.com/freebsd/freebsd-src/tree/main/usr.sbin/nscd >=20 > * The userland portion of the 802.11ac and Lightning stacks. scottl sugg= ested > that these were good candidates for Rust. >=20 > * freebsd-kpi-r14-0 . https://crates.io/crates/freebsd-kpi-r14-0 >=20 > Stuff that can live in ports, but would be nicer in base > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D >=20 > * gstat-rs https://crates.io/crates/gstat >=20 > * geom-exporter (I've started this, but haven't published it) >=20 > * nfs-exporter https://crates.io/crates/freebsd-nfs-exporter >=20 > * virtiofsd-rs . Nobody has yet tried to port it to FreeBSD. But if the > connection to bhyve(8) is too intimate, it might be hard to do in ports. > https://gitlab.com/virtio-fs/virtiofsd >=20 > * jail-exporter https://crates.io/crates/jail_exporter >=20 > * Various jail managers have been attempted in Rust. I think these are f= ine in > ports, but others like Goran Mekic have opined that they should be move= d to > base instead. >=20 > * musikid's pjdfstest rewrite. I think it would be great to start using = this > to test the base system's file systems. If the tests themselves lived = in > base, they would be easier to sync with file system development. > https://github.com/musikid/pjdfstest >=20 > * pf-rs. I suspect that the API isn't very stable. > https://crates.io/crates/pf-rs >=20 > * benchpmc. The pmc counter names changes between releases. > https://crates.io/crates/benchpmc >=20 > FreeBSD-related applications that are just fine in ports > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D >=20 > * fsx-rs. Unlike pjdfstest, this only tests datapath APIs. Those are us= ually > more stable than control path APIs, so I think there's little to be gai= ned by > moving this into base. https://crates.io/crates/fsx >=20 > * ztop. It uses ZFS's kstats sysctl interface, which is pretty stable. > https://crates.io/crates/ztop >=20 > * iocage-provision https://crates.io/crates/iocage-provision >=20 > * rsblk https://crates.io/crates/rsblk >=20 > * xfuse https://github.com/KhaledEmaraDev/xfuse >=20 > Other FreeBSD-related libraries in Rust > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Just see the list at https://crates.io/keywords/freebsd >=20 One new data point: DARPA is looking to rewrite a significant amount of C code to Rust with their "Translating All C to Rust (TRACTOR)" project: https://sam.gov/opp/1e45d648886b4e9ca91890285af77eb7/view Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 303-901-1600 / shawn_webb_opsec.50 https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --mnp5en7dxtqafvrw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmaqS/8ACgkQ/y5nonf4 4frHTQ/8DtRB+Lil25TF9JWKhFKchRyUuHGik05ju2w/Ve5ovX1lUNlmbu2PoVCN IY36s+YP49iwpTzrEu77QhHzfrSKJBy+D1m2688gnBv35T6f9oReRZwn9Px1j9EM l1ZZklK/YPZNIjrqghUA6Wk4mqHjWrb2RQImGiVXUfYEW/NhSN8N+rmqoddegcHc CFeuGYg0850q7OzAVumd7q4/vTiRrvP49ec6aJICMFf7XHiB3uR3FiXSmaThsKVi oKD2USR4uq9RHL7rpZZ2+mspQ+5L8+bwxVVyroIasvWYPXwITv3uRPLrYQ/jsaO0 b3K3jOjB8pZ+9VFyZBFrrAm4O/X2TFiIk3+hMaDnTv9WgkfsxEVPn4d+lMR++QIQ YvHOBv1kOsgi9Fsh6NlwXsZmLiLoZ9zTwrovO/4tHQnulVK+tmKI0RTbLoGG3Vtu lwRHgi9t8P4dCEXWMcYigbUIIR6M3JdUABQ5Ky2dQx/EWKBS/4K0ux9G6XWwT00e vkC1Y1uAUFzOQGhzQlpcADsmpS+3dC3ji3/wBgGS3UDURErkKHixEmcFGr9Zzl+j s6mtDJ5pu1HI5QU2PNCGDIF4ikrninGZg3csMArnMpoH00kGL/XtBFQSf6C1R33X eZrw55rdH1zF7ie5Ud+jpVmjU7/HG1a4x4PrLa1qei5zx+hbG98= =bsZA -----END PGP SIGNATURE----- --mnp5en7dxtqafvrw--