Top
Best
New

Posted by formerly_proven 12 hours ago

11 year old unsoundness bugs found in Rust borrow checker(github.com)
634 points | 364 commentspage 3
TesterVetter 3 hours ago|
[dead]
akoboldfrying 11 hours ago||
[flagged]
fg137 10 hours ago||
This is not the first soundness bug. Some bugs aren't fixed for years. The Rust community is well aware that such bugs exist, will be found, and address them just like other high impact bugs. In other words, if you paid the slightest attention to the development of Rust language, you would know this is surprising but not unexpected, and has happened many times.
akoboldfrying 10 hours ago||
Given that TFA is currently #1 on HN, I suspect I'm not the only person who is aware of Rust's borrow checker but not aware, until now, that it has a history of serious soundness bugs.
fg137 9 hours ago|||
> I'm not the only person who ...

This is not even the first soundness bug that appeared on HN frontpage. It just means you don't pay attention to Rust development, that's it. I don't even use Rust at all yet I know a number of quirks about its compiler.

akoboldfrying 9 hours ago||
> This is not even the first soundness bug that appeared on HN frontpage.

This is not a counterargument to my claim that "#1 on HN" status implies that many people are surprised by this.

> It just means you don't pay attention to Rust development

Correct, I don't. I never said that I did.

fg137 9 hours ago||
Sure. So if that's what you come here for,

I hereby confirm that you are not the only person who is aware of Rust's borrow checker but not aware, until now, that it has a history of serious soundness bugs.

Hope that settles this meaningless exchange.

zamalek 7 hours ago||||
The reason it's #1 is because this bug is so simple to trigger.
AnimalMuppet 9 hours ago|||
Well, it has a history of soundness bugs.

"Serious" soundness bugs? That's a stronger claim, and one that you introduced. So you have the burden of proof. Which of those soundness bugs are serious, and what about them makes them so?

akoboldfrying 9 hours ago||
From TFA:

> How on earth was this not found before this???

https://github.com/rust-lang/rust/issues/164250#issuecomment...

> Assigning P-high

https://github.com/rust-lang/rust/issues/164250#issuecomment...

In general I agree with fg137's assessment of soundness bugs as being inherently high-impact, i.e., serious:

> The Rust community is well aware that such bugs exist, will be found, and address them just like other high impact bugs.

Philpax 10 hours ago|||
People in sugar glass houses shouldn't throw stones :P
wg0 11 hours ago|||
You got my upvote and this one decade old issue:

https://github.com/rust-lang/rust/issues/25860

cowlevel 9 hours ago||
Is this the one exploited in cve-rs?
rvz 11 hours ago|||
[flagged]
mrlonglong 11 hours ago||
You got my upvote.
mrlonglong 9 hours ago||
And I laugh at downvoters.
shevy-java 9 hours ago||
[flagged]
rvz 11 hours ago||
[flagged]
optionalsquid 11 hours ago||
It looks like 18 of the 30 issues listed in table 4 had already been fixed when that paper was released, and there is activity in most of the rest. One was recently flagged as being fixed by -Znext-solver, and another has the submitter write that it is fixed, but the issue is not closed. And that's before you consider the impact of the individual issues; how many of the remaining issues impact "real" code?

So I don't think it's fair to claim that "no-one cared".

purplesyringa 11 hours ago|||
I don't think "no one cared" is a fair characterisation. The paper doesn't support this conclusion, and from experience I'd say that the two difficulties in fixing unsoundness are doing so without breaking existing code (Rust guarantees stability unless the code is unsound, and introducing previously missing checks can cause sound code to stop compiling, which is a problem if it occurs often) and doing so in a reliable way that can be supported long-term. Rust is currently in the progress of stabilizing next-solver and Polonius, both of which fix multiple long-standing bugs and have been worked on for years now due to intrinsic complexity, performance considerations, compatibility issues, etc. It's not that no one cares, it's just that this stuff is hard and takes time.
zamalek 7 hours ago|||
The borrow checker has been rewritten to improve this once, and another attempt (that is thought to clear up the rest) is on the way.

Things taking time to fix is not the same as not caring.

cowlevel 11 hours ago||
[flagged]
insanitybit 11 hours ago||
lol do you think that cve-rs was required? there is literally an l-unsound tag on rustc's github, this isn't some embarrassing or secret thing.

Safe rust is safe, granting `unsafe` and compiler errors. This isn't a secret.

psychoslave 11 hours ago||
What's l- here? Literal?
pas 11 hours ago||
"I" stands for "issue"

https://github.com/rust-lang/rust/labels?q=unsound

insanitybit 10 hours ago||
lol I was writing `l` because I thought it was `labeled-unsound` for like a fucking decade
high_na_euv 11 hours ago|||
in compare to c and cpp? it is
cowlevel 11 hours ago||
And in absolute terms?
sunshowers 7 hours ago|||
All memory safety on von Neumann architectures is specified with respect to a TCB. For Rust, the TCB includes the compiler. The TCB can have bugs. This doesn't invalidate the memory safety promise, given that it is made with respect to the TCB.

In contrast, memory-unsafe languages don't even try to have a TCB relative to which memory safety is specified. That's the main difference.

qweqwe14 11 hours ago||||
Literally nothing can be anything in absolute terms, what's your point? The fact is that Rust is miles better than any other language in terms of memory safety & performance ratio. That's all that matters.
bcjdjsndon 7 hours ago||
[flagged]
qweqwe14 4 hours ago||
The entire industry right now seems to think otherwise :)
cmrdporcupine 10 hours ago||||
"People still die in cars despite airbags and seatbelts so I don't see the point in wearing a seatbelt."
high_na_euv 11 hours ago|||
cmon, it is time move on.

it has been discussed bilion times

david-gpu 11 hours ago||
Let us not conflate a bug in an implementation (rustc) with a defect in the language (Rust).
mrkeen 11 hours ago|||
AFAIK there isn't a language spec. Rustc is the language for now.
afdbcreid 11 hours ago|||
But bugfixes are also allowed. So the fair conclusion is that the implementation is broken, but the language is not - because it's possible to fix, and it's possible for all known soundness issues (including the cve-rs one). For this one specifically, I've heard people are already working on a fix.
cowlevel 11 hours ago||
[flagged]
david-gpu 11 hours ago|||
My understanding is that it is work in progress, via Ferrocene.
Georgelemental 6 hours ago|||
Ferrocene is not a separate implementation of the compiler. It's the same Rustc, just a few versions behind and with a bunch of regulatory approvals attached. There is ongoing work on fixing all the unsoundnesses, happening as part of the main compiler development: https://goals.rust-lang.org/2026/roadmap-project-zero.html
beanjuiceII 10 hours ago|||
Ferrocene has his same flaw
david-gpu 10 hours ago||
If that's the case then I was wrong.
cowlevel 11 hours ago|||
Which clause of the language specification is being violated?
lkey 11 hours ago||
Lifetimes can be effectively erased via covariant assignment. It's in the title. Even a beginner could understand these assignments are not in spec? Are you just being contrary to be contrary?
csande17 10 hours ago|||
If that's the definition you're using, then C is also a safe programming language. In fact, C is even safer, because it actually does have a specification that lists all the invariants that the programmer has to uphold themselves because the compiler doesn't check them.
aw1621107 4 hours ago||
> In fact, C is even safer, because it actually does have a specification that lists all the invariants that the programmer has to uphold themselves because the compiler doesn't check them.

The difference is that the C spec intentionally frees the compiler from upholding those invariants. In this case the Rust compiler is failing to catch something it is required to catch.

A more accurate analogy would be a C compiler incorrectly failing to reject an assignment through a pointer to const without a cast. The spec requires that such a thing be rejected, so it's a compiler bug.

cowlevel 11 hours ago|||
So point to the spec
Ukv 10 hours ago|||
https://public-docs.ferrocene.dev/main/specification/types-a...

Specifically the `q.0 = Some(&l);` violating 4.15.2:40 ("An assignment expression requires that the type of its value operand is a subtype of the type of its assignee operand.")

cowlevel 9 hours ago||
That's a pretty basic property of any language. Why does the rust compiler fail to enforce it in this case?
ninkendo 9 hours ago||
> Why does the rust compiler fail to enforce it in this case?

A bug. The one linked, that we're all talking about.

Feel free to share a link to any software that has zero bugs.

beanjuiceII 10 hours ago|||
this is probably a great opportunity for rust to get one, if they want to be taken seriously
uniqueusername7 10 hours ago||
I totally understand that people have favourite languages and that rust, like any language and any ecosystem around that language, has idiosyncrasies that are not for everyone, but how would one ever come to the genuine conclusion that rust is not being taken seriously? By whom?
grommz 9 hours ago||
[flagged]
ivxvm 9 hours ago||
Hey, but it's genuinely a nice language. Maybe they're not the most brilliant of type theorists, but even without ownership/borrowing, just stuff like traits, structs/enums/unions with pattern matching, etc, is done quite well.
philipwhiuk 9 hours ago|||
What's wrong with Wales?
jambutters 9 hours ago||
The tech of the rust language is real though and is providing real world value
z3ratul163071 9 hours ago||
[flagged]
medler 9 hours ago|
It seems the bug here was caught by Asan instead of at compile time, so basically, for this one bug, rust is reduced to C++-like behavior. You’re still better off using rust because of all the bugs the borrow checker does catch.

The practical upshot to me is that you should be running your rust tests under asan.

JABVOLT 11 hours ago||
very very good job
fnord77 10 hours ago||
Here's the weakness of compiled programs. Does this compiled code have this vulnerability? You have no idea. At least with a VM or interpreter you can scan for vulnerable versions and replace the runtime or the specific library.

With this you have to recompile everything

cowlevel 9 hours ago||
It's possible to scan compiled programs at the assembly or machine code level. Not enough people do, which is fair enough because it's a slog, but it makes all compiler UB transparent to the analysis.
baq 10 hours ago||
That is less and less true by the day, for better or worse.
Rapzid 7 hours ago|
[flagged]
Rapzid 7 hours ago|
That was a bit generic and easy to swap "Rust" for whatever...

  Dense syntax pulsing
  Writhing and undulating
  What designer, who?
More comments...