12 ms·
The state of the kernel Rust experiment
- yourdetect 10mo agoFrom the comment section: > To me the more salient questions are how long before (a) we get Rust in a core subsystem (thus making Rust truly _required_ instead of "optional unless you have hardware foo"), and (b) requiring Rust for _all_ new code. Previously, the position was that C developers would not be forced to learn Rust. And a few days ago a security vulnerability was found in the Rust Linux kernel code. https://news.ycombinator.com/item?id=46309536 https://news.ycombinator.com/item?id=46309536
- AlotOfReading 10mo agoWhere did anyone promise that the Rust bits will never have security issues? That CVE was a fantastic demonstration of just how much better the situation is in Rust code and I don't think there's a realistic argument that the experiment has been anything other than successful.
- uecker 10mo agoWas it? It seems more a fantastic demonstration how the same type of errors can also occur in Rust code.
- jrimbault 10mo agoIn C this kind of issue is so common it wouldn't raise to the status of "CVE". People would just shrug and say "git gud".
- uecker 10mo agoThis is certainly not true. But also arguments about "common" are completely misleading as long as there is many orders of magnitude more C code than Rust code.
- Certhas 10mo agoMaybe you haven't been paying much attention in this space. Google found empirically that error density in _unsafe_ Rust is still much lower than in C/C++. And only a small portion of code is unsafe. So per LOC Rust has orders of magnitudes fewer errors than C/C++ in real world Android development. And these are not small sample sizes. By now more code is being written in Rust than C++ at Google: https://security.googleblog.com/2025/11/rust-in-android-move-fast-fix-things.html https://security.googleblog.com/2025/11/rust-in-android-move... But don't take my word for it, you can hear about the benefits of Rust directly from GKH: www.youtube.com/watch?v=HX0GH-YJbGw There really isn't a good faith argument here. You can make mistakes in Rust? No one denies that. There is more C code so of course there are more mistakes in C code than in Rust? Complete red herring.
- yourdetect 10mo ago[flagged]
- uecker 10mo agoThat is is undefined behavior does not mean it is exploitable. But I also have not seen an argument why a data race should not be exploitable in this context.
- yourdetect 10mo agoI am very wary of going that route. If there is undefined behavior, the compiler is in principle allowed to do anything and everything, unless it promises something beyond what the language promises. One could then argue that a specific version of a specific compiler with specific settings in a specific case, after investigation of the generated assembly or inspection of what guarantees the compiler provides beyond the language, is not exploitable. But other settings of the compiler and other versions of the compiler and other compilers may have different guarantees and generation of assembly. The Linux kernel uses, as I understand it, a flag for GCC for C code that disables strict aliasing. That basically means that strict aliasing is no longer undefined behavior, as long as that flag is used. Basically a dialect of C.
- uecker 10mo agoIt is very common for C implementation to define undefined behavior and also common for C programs to rely on this. For this reason, I think it is very misleading to say that undefined behavior is automatically exploitable or even a bug.
- johncolanduoni 10mo agoAnd the kernel is infamous for being picky about the C compilers it can be successfully built with - clang couldn’t build a working kernel for a long time, and it was mostly relying on subtle GCCisms.
- 10mo ago
- rtpg 10mo ago> And a few days ago a security vulnerability was found in the Rust Linux kernel code. was it a security vulnerability? I'm pretty sure it was "just" a crash. Though maybe someone smarter than me could have turned that into something more. I have no dog in this race, I really like the idea of Rust drivers but can very much understand retiscience at getting Rust to be handling more core parts of the kernel, just because Rust's value seems to pay off way more in higher level code where you have these invariants to maintain across large code paths (meanwhile writing a bunch of doubly-linked lists in unsafe Rust seems a bit like busy work, modulo the niceties Rust itself can give you)
- taneliv 10mo ago> was it a security vulnerability? I'm pretty sure it was "just" a crash. It's a race condition resulting in memory corruption.[1][2] That corruption is shown to result in a crash. I don't think the implication is that it can result only in crashes, but this is not mentioned in the CVE. Whether it is a vulnerability that an attacker can crash a system depends on your security model, I guess. In general it is not expected to happen and it stops other software from running, and can be controlled by entities or software who should not have that level of control, so it's considered a vulnerability. [1] https://www.cve.org/CVERecord/?id=CVE-2025-68260 https://www.cve.org/CVERecord/?id=CVE-2025-68260 [2] https://lore.kernel.org/linux-cve-announce/2025121614-CVE-2025-68260-558d@gregkh/T/#u https://lore.kernel.org/linux-cve-announce/2025121614-CVE-20...
- uecker 10mo agoIt is entertaining to observe that how - after the bullshit and propaganda phase - Rust now slowly enters reality and the excuses for problems that did not magically disappear are now exactly the same as what we saw before from C programmers and which Rust proponents would have completely dismissed as unacceptable in the past ("this CVE is not exploitable", "all programmers make mistakes", "unwrap should never been used in production", "this really is an example how fantastic Rust is").
- simonask 10mo ago
- dannersy 10mo agoThere are lots of vulnerabilities in the C code, too. Should we remove C or do we accept that fact that no language is perfect since they are used by humans and continue to make improvements and use tools that help us along as time goes forward? The cherry picking for this one Rust vulnerability to the ~150 C vulnerabilities is such a weird take that I can't help but think people have some weird hatred of Rust.
- yourdetect 10mo ago> Should we remove C or Your post is curious, for the post I quoted basically argued for just that eventuality for all new code. Even as the new language introduces undefined behavior vulnerabilities. The promises as stated previously, and the goal as stated by that lwn.net post now, are starkly different. And the poster did not even wait until the new language has proven its worth. And then a UB CVE comes by in the code in the new language. What Linus wrote in the past: https://www.phoronix.com/news/Torvalds-On-Rust-Maintainers https://www.phoronix.com/news/Torvalds-On-Rust-Maintainers > So when you change the C interfaces, the Rust people will have to deal with the fallout, and will have to fix the Rust bindings. That's kind of the promise here: there's that "wall of protection" around C developers that don't want to deal with Rust issues in the promise that they don't have to deal with Rust. That both you and that lwn.net poster writes these things, is extraordinarily weird and strange.
- dannersy 10mo agoBut this sounds like hubris and user error, then, and not a language discussion at all?
- uecker 10mo agoI do not think it is weird. Every C bug was taken as clear evidence that we need to abandon C and switch to Rust. So the fact that there are also such bugs in Rust is - while obvious - also important to highlight. So it is not weird hatred against Rust, but hatred against bullshit. And considering that most of the code is C, your 150 C vulnerabilities is a meaningless number, so you still continue with this nonsense.
- kubb 10mo agoI think you’ve said the quiet part out loud by mentioning learning Rust. The learning seems to be the only legitimate issue that people have. But they avoid mentioning it because it sounds intellectually lazy.
- simonask 10mo agoAnd it is intellectually lazy.
- bitwize 10mo agoAs Rust's advantages over C continue to be proven, a shift in position to "suck it up, C devs" is to be expected.
- tormeh 10mo agoEh, these are highly skilled individuals that just don't like learning a new thing, no matter how useful. That attitude is a problem to be managed, but these people deserve a certain amount of respect. Anyone saying "suck it" or similar should get a grip.
- qingcharles 10mo agoAgree. As a dev I've had to pivot a dozen times in my career. If you're a dev you should be able to learn a new language fairly quickly, all the core elements are the same, just the vocabulary is a little different. Since nobody has "fixed" C to avoid these bugs, and we're not going to go as far as put Java or .Net in the kernel, then I think Rust is probably the best, most pragmatic solution we have right now.
- thegrim000 10mo agoWell yeah, that's the strategy. "You don't need to learn it or use it, we just want to do our own separate things with it over here" .. some time later .. "Oh yeah it's working good for us, we think it'd be useful to use it in these additional places, think about the benefits!" .. some time later .. "Now it's going to be core and required, either deal with it or get out" They know they could never jump straight to the last step without revolt, so they shove their foot in the door with fake promises and smiles and then slowly over time force the door all the way open until they eventually get what they wanted from the beginning.
- aw1621107 10mo agoOnce again, congrats to the R4L team! It's a big milestone and I'm looking forwards to future developments!. There was a lot of interesting discussion on the previous post [0], but one thing I didn't see was much discussion about this bit: > The DRM (graphics) subsystem has been an early adopter of the Rust language. It was still perhaps surprising, though, when Airlie (the DRM maintainer) said that the subsystem is only "about a year away" from disallowing new drivers written in C and requiring the use of Rust. I was a bit surprised when I first read this. Is this meant to be read in a way that is more just a description of the state of Rust bindings (e.g., the DRM subsystem is about a year away from being able to require the use of Rust, but isn't actually planning on doing so), or it is describing actual plans (e.g., the DRM subsystem is about a year away from actually requiring the use of Rust)? I was originally more inclined to go for the former interpretation, but this other bit: > With regard to adding core-kernel dependencies on Rust code, Airlie said that it shouldn't happen for another year or two. Makes me think that perhaps the devs are actually considering the latter. Is anyone more in-the-know able to comment on this? [0]: https://news.ycombinator.com/item?id=46213585 https://news.ycombinator.com/item?id=46213585
- pitaj 10mo agoI'm not more "in the know" but it makes sense that new drivers could require it. New drivers, after all, are pretty much always written for newer platforms that Rust has support for. The main issue with enabling Rust (let alone requiring it) is that Linux still supports platforms which Rust does not.
- tonfa 10mo agoIs DRM considered core kernel dependencies?
- aw1621107 10mo agoI don't know. My line of thinking is that if the Linux devs are comfortable with using Rust in core Linux then they might also be comfortable requiring Rust for new drivers as well. No idea if that makes sense, though.
- jgarzik 10mo agoSomewhat related, a kernel in Rust: https://github.com/jgarzik/hk https://github.com/jgarzik/hk
- josephg 10mo agoIf you're going to plug your own project, you might want to mention that in your comment. There's dozens of rust osdev projects. Its an open question if any become relevant like linux.
- keepamovin 10mo agoOfftopic but this title makes me want to create an alternate-universe version of the HN front page where every title is shrill/spectacular/hysterical/urgent/clickbaity. Such as: The Absolute State of the Kernel Rust Experiment Right Now And every comment has its confidence/aggressiveness taken up to 11 (tho still within site rules).
- RustSupremacist 10mo agoThis author is not someone who should be reporting on Rust especially in the kernel: https://www.youtube.com/watch?v=gVC1gp2PS8U&t=1538s https://www.youtube.com/watch?v=gVC1gp2PS8U&t=1538s
- aw1621107 10mo agoMind elaborating on what exactly is wrong in that video? Or how that is relevant to the article's contents?
- Rakshath_1 10mo ago[flagged]
- yourdetect 10mo ago[flagged]
- ibotty 10mo agoThere is relatively little Rust in the kernel, but there are even less Rust CVEs. In this cycle alone there were 160 CVEs, one in Rust. The first one! The amount of rust is way less than 1/160 and even that statistic is off, because one should count all CVEs.
- Someone 10mo ago> because one should count all CVEs. That is debatable, and I think untrue. It sometimes takes years to find CVEs in C code, and I don’t know of an argument why that would be different for Rust. The fairest comparison, I think, would be with other new code of similar complexity in the kernel, and track #of CVEs per equivalent functionality (per line of code might be sufficient, but if one language is verbose than the other, you should correct for that)
- aw1621107 10mo agoThere's this bit from the article which might provide a hint: > Drivers in Rust, [Greg KH] said, are indeed proving to be far safer than those written in C. And since CVEs haven't been getting assigned to Rust code until recently, I think he's more well-positioned to opine on the safety of Rust code vs. C code in Linux than those who are only indexing off the singular Rust CVE so far.
- airstrike 10mo agoIt's in a block explicitly marked unsafe lmao As opposed to an implicitly unsafe what 1 million lines of C
- 10mo ago
- Jean-Papoulos 10mo ago>Bergmann agreed with declaring the experiment over, worrying only that Rust still "doesn't work on architectures that nobody uses". I love you Arnd. More seriously, this will become an issue when someone starts the process of integrating Rust code into a core subsystem. I wonder whether this will lead to the kernel dropping support for some architectures, or to Rust doing the necessary work. Probably a bit of both.
- nevi-me 10mo agoI suspect more the latter than anything. It could be that by the time Rust gets used in the kernel core, one or both of the GCC implementations would be functional enough to compile the kernel. I'm curious though, if someone has an ancient/niche architecture, what's the benefit of wanting newer kernels to the point where it'd be a concern for development? I presume that outside of devices and drivers, there's little to no new developments in those architectures. In which case, why don't the users/maintainers of those archs use a pre-6.1 kernel (IIRC when Rust was introduced) and backport what they need?
- testdelacc1 10mo agoNo one is doing any kind of serious computing on 30 year old CPUs. But the point of the hobby isn’t turning on the computer and doing nothing with it. The hobby is putting together all the pieces you need to turn it on, turning it on and then doing nothing with it. There’s an asymmetry in what the retro computing enthusiasts are asking for and the amount of effort they’re willing to put in. This niche hobby benefits from the free labour of open source maintaining support for their old architectures. If the maintainers propose dropping support because of the cost of maintenance the hobbyists rarely step up. Instead they make it seem like the maintainers are the bad guys doing a reprehensible thing. You propose they get their hands dirty and cherry pick changes from newer kernels. But they don’t want to put in effort like that. And they might just feel happier that they’re using the “real” latest kernel.
- deleted 10mo ago[deleted]
- globalnode 10mo ago[flagged]
- Mikhail_K 10mo ago[flagged]
- atoav 10mo agoIf you build a house out of inflammable bricks instead of magnesium ones you can at least rule out magnesium fires. Now the question is: If we live in a world where magnesium fires are common, can we afford to not at least try building with the inflammable bricks? I know this topic stokes emotions, but if you haven't tried Rust as someone with C/C++ experience, give it a go. You will come out wiser on the other side, even if you never use the language for anything.
- sprash 10mo ago[flagged]
- CamouflagedKiwi 10mo agoI've done a bit of work with Rust, and while I did find some of the complexity frustrating, it wasn't _that_ bad. While I could sort of see some situation like you describe with a secret agenda from big tech, I think that probably requires significantly more cunning & organisation than they actually have around this stuff. It's not like Microsoft invented Rust - in fact it came from a relatively small corp in the first place.
- sprash 10mo agoIt is irrelevant who invented Rust. The relevant fact is that it can be used as a tool to divide the community because of its very opinionated design. Systemd was equally opinionated and also caused huge division. Who is paying the bills of Poettering these days: Microsoft. The Halloween documents show that Microsoft is playing these games for a long time now. Who knows in which way they have advanced their psyops. Just because we can't read their E-mails anymore doesn't mean they stopped doing it.
- 0dayz 10mo ago>It is irrelevant who invented Rust. The relevant fact is that it can be used as a tool to divide the community because of its very opinionated design. Compared to C where it has the opinion of no fixed data types making you deal with it. >Systemd was equally opinionated and also caused huge division. Who is paying the bills of Poettering these days: Microsoft. Systemd was only opinionated in how it should break posix, because it's meant to be Linux only. And you're then saying that there is credible evidence that Poettering was a Microsoft mole almost 15 years ago with instructions to create systemd to "disrupt" the Linux ecosystem? Boy did Microsoft fail there, more distros than ever adopted it and it's these days almost entirely pain free. >The Halloween documents show that Microsoft is playing these games for a long time now. Who knows in which way they have advanced their psyops. Just because we can't read their E-mails anymore doesn't mean they stopped doing it. If you have actually read the docs you would know that their strategy is not to divide and conquer as they say FUD does not work, but to instead compete with OSS.
- bjhsuw8ud 10mo ago[flagged]
- Pannoniae 10mo agoThis comment is interesting and adds to the discussion but it would be quite a bit better without the flamewar-style swipes in the last sentence :)
- johncolanduoni 10mo agoPlease explain how it adds to the discussion about different ways to broaden supported Rust target architectures. Because both have the word Rust in them?
- Pannoniae 10mo agoIt contained an interesting link and I tried to be friendly. You're right though, not very on topic.
- johncolanduoni 10mo agoThat was definitely me, you got me. How did you know from my comment about a potential Alpha LLVM backend?
- meindnoch 10mo agoIt's so tiresome.
- black_13 10mo ago[dead]