Before Rust starts getting used "for real" in the kernel there's a lot of barriers to overcome. Most maintainers aren't hugely proficient in Rust and absolutely do not have the time to learn. Needing yet another toolchain is annoying (especially when you need bits that aren't in stable yet), anything you write in Rust probably won't get built in distro kernels for a long time, and anything you work on today is hugely uncharted territory since it's all so new.
I think one thing a lot of people don't understand from "outside" the kernel development sphere is that standards for getting stuff upstream are typically pretty high for most subsystems, a lot higher than most open source projects. There are a lot of open questions about Rust in Linux that don't have clear answers, and Linux really struggles with consensus. Yes it has a dictator, but that dictator very rarely dictates anything that hugely moves the needle.
I do think "real" kernel bits written in Rust will get upstream and will get used, but it will be a very slow burn.
If I'm not mistaken, the first stable Firefox releases including notable usage of Rust code came out in late 2017. So that's about 6 years of Rust in Firefox.
From a Firefox user's perspective, I can't say that I'm impressed by it.
Building Firefox from source is more involved than it was before. As you mentioned, additional tooling for Rust is required in such a situation.
I haven't really noticed any real Firefox feature, functionality, or performance improvements that I could directly attribute to the use of Rust.
It also doesn't seem like using Rust has allowed the Firefox developers to be significantly more efficient or productive than they were before.
Maybe an argument could be made that some security issues, for example, have been avoided thanks to Rust, but that's not really provable in any meaningful way.
After seeing the Firefox situation, my expectations for the use of Rust in the Linux kernel are pretty low.
Google has some pretty good data on this: https://security.googleblog.com/2022/12/memory-safe-language...
As for Firefox, the CSS engine was rewritten to be parallel, among other improvements (new wasm compiler, new parallel compositor) that would have been challenging without Rust: https://wiki.mozilla.org/Oxidation
> but that's not really provable in any meaningful way.
Can you prove that Rust didn't make developers more productive?
Also, that there are less memory bugs in Rust then in C++ is just common sense and pretty generally accepted. It doesn't need to be proven again for every project.
> After seeing the Firefox situation
The situation where more and more code is written in Rust because most people prefer it?
Multi-core CSS engine and GPU-accelerated rendering in Firefox are in Rust. Without them Firefox was really behind in performance (if you're unimpressed now, imagine it being way worse).
Can LLMs help here with code (re)writing?
Whether Rust in the kernel succeeds or not will likely be determined by whether or not a sufficiently clear boundary can be drawn between the bit that must be unsafe (in the Rust sense) and the rest. And how much code is in the latter. I don't think we know the answer yet but some knowledgable people are willing to run the experiment on the basis that the probability seems quite high that a safe subset can be determined.
In the LLM case mentioned, having to hop a syscall every few teraflops is probably not a compelling reason to live in kernel space.
If you're talking about option A) or B), we already have things like mrustc and c2rust. These are though problems, LLMs aren't _that_ smart yet.
There are many out-of-tree examples of rust kernel code, but as of right now, none have been merged.
For those not in the know, gregkh = Greg Kroah-Hartman
https://en.wikipedia.org/wiki/Greg_Kroah-Hartman
> broodbucket
Core kernel will never have Rust in it, and that is a correct decision. Linux and C have a long history of just working, and there is value in making sure that C code you write is correct and explicitly thinking about memory and what gets modified where. Correct coding is more than just memory safety, and compilers can't check everything for you.
https://lore.kernel.org/rust-for-linux/bddea099-4468-4f96-2e...
https://lore.kernel.org/rust-for-linux/c61a60ef-fa9d-44ea-98...
The above thread is really strange that they picked such a niche thing in networking to contribute to, as sockets don't have many uses within the kernel itself other than NFS or dhcp or stuff like that. They should have aimed to add things to the QoS layer, qdisc, classifier, whatever, there's tens of those and you can easily add another. Start small.
The problem really is that the people who want to see Rust in the linux kernel have next to no linux kernel background and have a poor understanding of how Linux works and how things are generally done.
Also the people who contribute big things to the linux kernel usually have a clear business case behind them and a big company paying them to work on it full time.
For example I could imagine Microsoft eventually contributing in this regard, say they want some more Hyper-V virtual hardware drivers in Linux and they decided to do that in Rust. They've been lately using Rust in the Windows kernel so it's not that unrealistic to think it may happen.
A filesystem written in Rust would be cool... but it's probably going to have to be a new one rather than a rewrite, I can't imagine people going through the trouble of rewriting btrfs in Rust. And big names like Facebook could actually back that effort.
I really love using Rust for middleware things, however right now I can't convince myself to use it on low level things like OSes or microcontrollers since it seems to be a lot of trouble with getting Rust to play nice with FreeRTOS for example, and there seems to be no production ready rtos written in Rust either.
> https://lore.kernel.org/rust-for-linux/bddea099-4468-4f96-2e...
> https://lore.kernel.org/rust-for-linux/c61a60ef-fa9d-44ea-98...
I don’t see how either post supports your points. The first is about OOT vs in-tree modules and the second isn’t about anything specific to Rust. You just picked a random post from someone learning about kernel development who happened to be using Rust.
The people doing core Rust for Linux work (not random mailing list participants) are actually very qualified and very knowledgeable about Linux. I don’t think your characterization of them is fair at all.
Grabbing random mailing list posts from non core maintainers and trying to extrapolate conclusions about an entire multi-year is not a good way to evaluate a project.
>participants) are actually very qualified and very knowledgeable about
> Linux. I don’t think your characterization of them is fair at all.
Alright, they are very qualified and knowledgeable, what is a fair characterization of the work they're doing?
It's been a year, let's see how much stuff they managed to merge, My terminal window has 135 rows:
cd linux/
git log --oneline rust/
output <space> output <space> output <space> no output
Oh wow, how many people was it again?
git shortlog -s -n -e --all --no-merges rust/ | wc -l
29
Most of those guys have single digits number of commits and there are 7 guys with double digits number of commits so let's say there's about 7 people most active doing rust in linux.
Do you know Rust yourself? Take a look at the bulk of the patches that got merged, could you write that if someone paid you? My guess is yes, because it looks pretty average to me. (No offense to you personally).
My understanding is that the `rust-next` branch represents what's ready for Linus to merge. So there's a whole lot that's not in there, which you're missing in your evaluation.
Last year a Kernel dev from Western Digital wrote an NVME driver in Rust [1] (look at slides 15 & 16) which I would consider to be qualified and knowledgeable.
I wouldn't measure the effort solely on what's been merged to mainline as there's been 6 merge windows from 6.1 to now. Many of those commits are laying the groundwork for the next few years.
[0] https://github.com/torvalds/linux/compare/master...Rust-for-... [1] https://lpc.events/event/16/contributions/1180/attachments/1...
NVMe drives are probably the simplest form of storage you can possibly think of in today's day and age, from a user perspective. Which is a perfect candidate for a proof of concept like that. Not saying that it's not good work.
In those 1500+ commits I see a lot of noise, and some good stuff, I like the alloc stuff, chardevs, buffer management, the async executor stuff looks really good scrolls scrolls, scrolls, okay yes.
A lot of this stuff looks meaningful and I hope to see it merged in the near future.
"The problem really is that the people who want to see Rust in the linux kernel have next to no linux kernel background and have a poor understanding of how Linux works and how things are generally done."
Is this a non topic then?
Having drivers in Rust is one thing. Drivers were done in C++ before. But you use a subset because a language targeting kernel needs to use kernel facilities. You won't be able to use your standard library. Syntax needs to be resolved to what kernel provides, or dropped.
That's why C++ in kernel never took off that seriously, when you restrict it, and when you already have to accommodate for kernel's "API mindset", what's left of language in between isn't that important.
Everything else in C++ is just syntactic sugar to me. Very useful syntactic sugar, but just sugar.
Alright placement new is quite nice too. Since there are so many ways to allocate memory in the linux kernel.
As far as RAII goes, ehhhh I don't know. KASAN and kmemleak do a pretty ok job.
But then again as I understand it the spec is so massive and has plenty of problems it may not be something that is improved by rust.
So many developers have said this over the years but it almost never comes true.
You just end up with different bugs in a different language.
I dunno why I misread "write in any language" with "write in another language".
I'm still skeptical about rewriting - the bluetooth spec is notoriously buggy itself, and many "bugs" and glitches in BT are due to how poorly the spec is written.
That said I have worked extensively with Bluetooth within Ericsson and while there is a learning curve, I never found the spec to be lacking.
Latest example : https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?d...