News for hackers. Stuff that matters.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by themafia on Wednesday December 17, 2025 @01:44PM (#46303678)
So the prediction that incautious and unverified unsafe {} blocks would cause CVEs seems entirely accurate.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by mustache_kimono on Wednesday December 17, 2025 @02:58PM (#46304710)
> So the prediction that incautious and unverified unsafe {} blocks would cause CVEs seems entirely accurate.

This is one/the first CVE caused by a mistake made using unsafe Rust. But it was revealed along with 159 new kernel CVEs found in C code.[0]

It may just be me, but it seems wildly myopic to draw conclusions about Rust, or even, unsafe Rust from one CVE. More CVEs will absolutely happen. But even true Rust haters have to recognize that tide of CVEs in kernel C code runs something like 19+ CVEs per day? What kind of case can you make that "incautious and unverified unsafe {} blocks" is worse than that?

[0]: https://social.kernel.org/notice/B1JLrtkxEBazCPQHDM

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by uecker on Wednesday December 17, 2025 @03:31PM (#46305099)
Github says 0.3% of the kernel code is Rust. But even normalized to lines of code, I think counting CVEs would not measure anything meaningful.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by taproottap on Wednesday December 17, 2025 @04:17PM (#46305622)
It would probably have to be normalized to something slightly different as lines of code necessary to a feature varies by language.. But even with the sad state of CVE quality, I would certainly prefer a language that deflects CVEs for a kernel that is both in places with no updates and in places with forced updates for relevant or irrelevant CVE.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by mustache_kimono on Wednesday December 17, 2025 @04:11PM (#46305562)
> Github says 0.3% of the kernel code is Rust. But even normalized to lines of code, I think counting CVEs would not measure anything meaningful.

Your sense seems more than a little unrigorous. 1/160 = 0.00625. So, several orders of magnitude fewer CVEs per line of code.

And remember this also the first Rust kernel CVE and C kernel code CVEs both continue to accrue at an astonishing rate, and had accrued previously.

Taking a one week snapshot and saying Rust doesn't compare favorably when Rust CVEs are 1/160, and C CVEs are 159/160 is just nuts.

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by mustache_kimono on Wednesday December 17, 2025 @09:29PM (#46308309)
> Your sense seems more than a little unrigorous. 1/160 = 0.00625. So, several orders of magnitude fewer CVEs per line of code.

This is incorrect. Chalk it up to the flu and fever! Sorry.

0.00625 == .625%. or about twice the instance of Rust code however as stated above these are just the metric from one patch cycle.

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by uecker on Thursday December 18, 2025 @02:58AM (#46310026)
It wasn't me trying to conclude anything from insufficient data.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by pjjpo on Thursday December 18, 2025 @08:25AM (#46312354)
I'm more interested in the % of rust code that is marked unsafe. If you can write a kernel with 1% safe, that sounds pretty great. If the nature of dealing with hardware (AFAIK most of a kernel is device drivers) means something higher, maybe 10%, then maybe safety becomes difficult, especially because unsafety propagates in an unclear way since safe code becomes unsafe to some degree when it calls into it.

I'm also curious about the percentage of implicit unsafe code in C, given there are still compilers and linters checking something, just not at the level of lifetimes etc in Rust. But I guess this isn't easy to calculate.

I like rust for low level projects and see no need to pick C over it personally - but I think it's fair to question the real impact of language safety in a realm that largely has to be unsafe. There's no world where Rust is more unsafe than C though so it's all academic. I just wonder if there's been any analysis on this, in close to metal applications like a kernel.

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by mustache_kimono on Thursday December 18, 2025 @03:53PM (#46318552)
> I'm more interested in the % of rust code that is marked unsafe.

I think you should less interested in % unsafe as what the unsafe is used to do, that is, it's likelihood to cause UB, etc. If it's unsafe to interface with C code, or unsafe to do a completely safe transmute, I'm not sure one should care.

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by uecker on Friday December 19, 2025 @03:54AM (#46323690)
> There's no world where Rust is more unsafe than C though so it's all academic

I think Rust is more unsafe than C due to supply chain issues in the Rust ecosystem, which have not fully materialized yet. Rust certainly has an advantage in terms of memory safety, but I do not believe it is nearly as big as people like to believe compared to a C project that actually cares about memory safety and applies modern tooling to address safety. There seems to be a lot of confirmation bias. I also believe Rust is much safer for average coders doing average projects by being much safer by default.

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by mustache_kimono on Friday December 19, 2025 @03:35PM (#46330588)
> I think Rust is more unsafe than C due to supply chain issues in the Rust ecosystem

This is such an incredibly cheap shot. First, the supply chain issues referenced have nothing to do with Rust, the language, itself. Second, Rust's build system, cargo, may have these issues, but cargo's web fetch features simply aren't used by the Linux kernel.

So -- we can have a debate about which is a better a world to live in, one with or without cargo, but it really has nothing to do with the Linux kernel security.

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by thrance on Wednesday December 17, 2025 @04:22PM (#46305670)
To be actually fair, you should probably only look at CVEs concerning new-ish code.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by accelbred on Thursday December 18, 2025 @12:04AM (#46309055)
The kernel policy for CVEs is any patch that is backported, no? So this is just the first Rust patch, post being non-experimental, that was backported?
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by nottorp on Thursday December 18, 2025 @09:05AM (#46312814)
If you tell us $LANGUAGE is the second coming of $DEITY daily, in multiple ways, we will expect that it is the second coming.

What's even the point of introducing Rust into the Linux kernel when you have to use the hidden under the rug unsafe parts of it to function?

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by stouset on Friday December 19, 2025 @01:42AM (#46322894)
All of C is unsafe. Tiny, limited parts of kernel Rust code are unsafe. The percentage of unsafe Rust code will almost certainly decrease over time.

This isn’t really hard to wrap your head around.

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by hulitu on Friday December 19, 2025 @02:41AM (#46323247)
> The percentage of unsafe Rust code will almost certainly decrease over time.

Famous last words. /s

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by K0nserv on Wednesday December 17, 2025 @02:01PM (#46303931)
Isn’t it obvious that the primary source of CVEs in Rust programs would be the portions of the program where the human is charge of correctness instead of the compiler?

The relevant question is whether it results in fewer and less severe CVEs than code written in C. So far the answer seems to be a resounding yes

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by Hemospectrum on Wednesday December 17, 2025 @03:05PM (#46304799)
It is not obvious to those who refuse to understand, and who preemptively reject case studies on the grounds that the numbers are surely fabricated.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by woodruffw on Wednesday December 17, 2025 @02:03PM (#46303971)
"Cause" seems unsubstantiated: I think to justify "cause," we'd need strong evidence that the equivalent bug (or worse) wouldn't have happened in C.

Or another way to put it: clearly this is bad, and unsafe blocks deserve significant scrutiny. But it's unclear how this would have been made better by the code being entirely unsafe, rather than a particular source of unsafety being incorrect.

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by ganelonhb on Wednesday December 17, 2025 @02:06PM (#46304014)
The definition of cause is quite clear. “Rust” is obviously not the cause, but it did fail to be the solution, here. You can’t avoid that.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by bigstrat2003 on Wednesday December 17, 2025 @02:13PM (#46304118)
But it didn't promise to be the solution either. Rust has never claimed, nor have its advocates claimed, that unsafe Rust can eliminate memory bugs. Safe Rust can do that (assuming any unsafe code relied upon is sound), but unsafe cannot be and has never promised to be bug free.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by nottorp on Thursday December 18, 2025 @09:06AM (#46312825)
Ok so why is Rust in the kernel if you can't use safe rust there and what's left is not what Rust promises?
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by woodruffw on Thursday December 18, 2025 @11:12AM (#46314564)
Most of the kernel's Rust usage is safe Rust. The only unsafe Rust is there to interact with the rest of the kernel and to provide safe abstractions.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by woodruffw on Wednesday December 17, 2025 @02:10PM (#46304067)
Except that it didn't fail to be the solution: the bug is localized to an explicit escape hatch in Rust's safety rules, rather than being a latent property of the system.

(I think the underlying philosophical disagreement here is this: I think software is always going to have bugs, and that Rust can't - and doesn't promise - to perfectly eliminate them. Instead, what Rust does promise - and deliver on - is that the entire class of memory safety bugs can be eliminated by construction in safe Rust, and localized when present to errors in unsafe Rust. Insofar as that's the promise, Rust has delivered here.)

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by uecker on Wednesday December 17, 2025 @03:04PM (#46304781)
You can label something an "explicit escape hatch" or a "latent property of the system", but in the end such labels are irrelevant. While I agree that it may be easier to review unsafe blocks in Rust compared to reviewing pointer arithmetic, union accesses, and free in C because "unsafe" is a bit more obvious in the source, I think selling this as a game changer was always an exaggeration.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by woodruffw on Wednesday December 17, 2025 @03:11PM (#46304879)
Having written lots of C and C++ before Rust, this kind of local reasoning + correctness by construction is absolutely a game changer. It's just not a silver bullet, and efforts to miscast Rust as incorrectly claiming to be one seem heavy-handed.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by tialaramex on Wednesday December 17, 2025 @05:57PM (#46306755)
Google's feedback seems to suggest Rust actually might be a silver bullet, in the specific sense meant in the "No Silver Bullet" essay.

That essay doesn't say that silver bullets are a panacea or cure all, instead they're a decimal order of magnitude improvement. The essay gives the example of Structured Programming, an idea which feels so obvious to us today that it's unspoken, but it's really true that once upon a time people wrote unstructured programs (today the only "language" where you even could do this is assembly and nobody does it) where you just jump arbitrarily to unrelated code and resume execution. The result is fucking chaos and languages where you never do that delivered a huge improvement even before I wrote my first line of code in the 1980s.

Google did find that sort of effect in Rust over C++.

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by uecker on Thursday December 18, 2025 @01:53AM (#46309626)
As a scientist, I would not trust self reports from the industry too much. Even if those are honest, there are too many things that could bias this.
Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by n2d4 on Wednesday December 17, 2025 @02:04PM (#46303991)
Sure, but that's not really that interesting or controversial.

The more useful question is, how many CVEs were prevented because unsafe {} blocks receive more caution and scrutiny?

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by themafia on Wednesday December 17, 2025 @05:35PM (#46306523)
If you could find a way to actually measure that it would be useful. I doubt this is actually achievable in our Universe.

If all of C is effectively "unsafe" then wouldn't it receive the _most_ scrutiny?

Since this didn't work then I don't understand Rust's overall strategy.

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by goku12 on Wednesday December 17, 2025 @10:25PM (#46308606)
That's not how it works. A larger codebase to scrutinize means that there's more chance of missing a memory safety bug. If you can keep the Rust unsafe block bug-free, you don't need to worry about them anymore in safe Rust. They're talking about attention getting divided all over the code where this distinction is not there (like C code). They always have been.

On top of that, there is something else they say. You have to uphold the invariants inside the unsafe blocks. Rust for Linux documents these invariants as well. The invariant was wrong in this case. The reason I mention this is because this practice has forced even C developers to rethink and improve their code.

Rust specifies very clearly what sort of error it eliminates and where it does that. It reduces the surface area of memory safety bugs to unsafe blocks, and gives you clear guidelines on what you need to ensure manually within the unsafe block to avoid any memory safety bugs. And even when you make a human error in that task, Rust makes it easy to identify them.

There are clear advantages here in terms of the effort required to prevent memory safety bugs, and in making your responsibilities explicit. This has been their claim consistently. Yet, I find that these have to be repeated in every discussion about Rust. It feels like some critics don't care about these arguments at all.

Re:Linux Kernel Rust Code Sees Its First CVE Vulnerability by crote on Thursday December 18, 2025 @03:46AM (#46310308)
Obviously. If you use a language which inherently makes memory safety bugs in regular code impossible, all memory safety bugs will be contained to the "trust me, I know what I'm doing - no need to check this" bypass sections. Similarly, all drownings happen in the presence of water.

The important thing to remember is that in this context C code is one giant unsafe {} block, and you're more likely to drown in the sea than in a puddle.