Rust in the FreeBSD kernel

I am following the Linux Rust experiment with much interest.
The most curious thing for me is where and how they will harness the (comparative to C) great power of Rust.
But so far I see only simple and trivial kernel drivers being done in Rust.
Apropos serious operating system use of Rust, have you seen the work of the Google Android (a Linux fork) team?

About three years ago Google decided to analyze the CVE for Android bugs, and pick a hot spot (modules in the codebase where the most defects were found over the past several years) to refactor into Rust. That experiment was successful enough that they kept going.

Apparently the team had almost no Rust experience when they started.

Newly reported exploitable defects in Android began falling immediately, and have continued falling, steadily.

Rust in Android: Move fast and fix things.
 
Aren't device drivers inherently not suitable for safe programming? Every time you write into device memory it is unsafe.
There's at least some theoretical advantage to implementing a device driver in memory safe languages due to the exploitability of the non-DMA parts of the driver.

Every other member of this forum knows more about this than do I, but a quick glance at the CVE for FreeBSD shows some candidate examples (one would need to look at the code commit history of the patch to see for certain.) Consider CVE-2025-0373 Buffer overflow in some filesystems via NFS including tarfs and ext2fs as one possible example.
 
I don't think hatred is what drives most people and even organizations. There are valid technical reasons to use FreeBSD that are not related to the licenses.

Most of the push for Rust+MIT is ideological, though. They do hate the FSF because of Richard Stallman.
Apple, rather famously, spent about 20 years and invested a few billion dollars to expunge the GPL from macOS. This was one of several motivations behind LLVM/Clang.
 
This is the 39c3 talk about FreeBSD jails. We discussed the general conclusions in a different thread, but I want to add it here because it mentions Rust in the FreeBSD kernel as one recommendation. They found 50 or so bugs mostly related to jails isolation and a majority of those wouldn't have happened in Rust.


47 min 40 sec ia the recommendations is Rust.

54:50 is a followup question - would you turn on integer overflow checking?
Color me skeptical
 
Here is a paper on using LLMs to help with memory safety in C:

 
Here is a paper on using LLMs to help with memory safety in C:

April arrived rather late in the year.
 
April arrived rather late in the year.

I don't see it as that hopeless.

I see it as something you let loose on your existing code, which you already engineered to have no memory errors you are aware of. The LLM gives additional suggestions. Outside an occasional misleading comment that could confuse you into relexing your perfectly fine own code I see this as a useful additional eye on the same code.
 
Back
Top