logoalt Hacker News

Memory Safety Bugs in Rust Standard Library

108 points • by pjmlp • last Friday at 5:22 AM • 37 comments • view on HN

Comments

simonask • today at 7:48 AM

Just because emotions seem to be always boiling whenever Rust is mentioned, I want to clarify for people who only follow casually that there is nothing unusual or scandalous about these finds.

The Rust project as a whole currently has 178 open issues with the tag I-unsound[1]. Many of these describe issues that only exist in the nightly compiler, of course, but it does happen that bugs are not caught before shipping. That's software.

[1]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+state%...

➕ show 1 reply
hingler36 • today at 6:37 AM

I've always felt that parts of the Rust standard library to be weirdly un-rusty. Like indexing a vector panicking instead of returning a Some(T) in case the index is out of bounds. It's easy to avoid if you put the effort in of course, but it did always feel weird that one of the first data structures you learn has this behavior right out of the gate.

➕ show 3 replies
nektro • today at 6:14 AM

> Pattern 2: Trusting user-provided implementations to be correct

reminds me of the tales from https://oxide.computer/blog/iddqd-unsafe

nektro • today at 5:49 AM

> Notes from Microsoft Security's Frontier Offensive Research & Generative Exploitation Lab.

Panzerschrek • today at 7:44 AM

> But many operations in Rust can panic, from out-of-bounds indexing to calls into user-provided code, and by default a panic unwinds

That's why I think having unwinding in Rust is a mistake. It gives a false sense of safety, but it's very hard to write unwinding-correct code. So, it would be better to handle panics as immediate process termination instead.

➕ show 1 reply
senderista • today at 6:13 AM

I sure wish they'd rewrite the Azure Linux VM Agent in Rust. That thing normally burns 10-15% of a core, and also blocks VM restart for tens of minutes, god knows why.

➕ show 2 replies
mesm7903 • today at 6:36 AM

[flagged]

jdw64 • today at 7:08 AM

[dead]

not_a_bot_4sho • today at 6:00 AM

A good use for AI

➕ show 1 reply
drnick1 • today at 6:48 AM

[flagged]

➕ show 2 replies