Date: Wed, 31 Jul 2024 14:36:54 +0000 From: Shawn Webb <shawn.webb@hardenedbsd.org> To: Alan Somers <asomers@freebsd.org> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org>, Warner Losh <imp@bsdimp.com>, Scott Long <scottl@freebsd.org>, meka@tilda.center Subject: Re: The Case for Rust (in the base system) Message-ID: <vdmg5zocd6wqcwc2bvzvzqn4bii2pwdc2r4mgnisukfkboj6nf@f7lv5quu4fjx> In-Reply-To: <CAOtMX2hAUiWdGPtpaCJLPZB%2Bj2yzNw5DSjUmkwTi%2B%2BmyemehCA@mail.gmail.com> References: <CAOtMX2hAUiWdGPtpaCJLPZB%2Bj2yzNw5DSjUmkwTi%2B%2BmyemehCA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?vdmg5zocd6wqcwc2bvzvzqn4bii2pwdc2r4mgnisukfkboj6nf>