Live data from Hacker News

“Rust is safe” is not some kind of absolute guarantee of code safety

lkml.org

21–30 of 542 posts

Re: “Rust is safe” is not some kind of absolute guarantee of code safety

#21

To put things in context, Linus is being reasonable and wise and well-mannered once again. Wouldn't mind reading a few juicy expletives, to be honest.

I wonder if he'll end up regretting opening this particular Pandora's box or will things stabilize eventually.

If everyone who wrote a blogpost about how rewriting thing x in Rust would be amazing actually rewrote x in Rust it would already be the most popular language ever.

Re: “Rust is safe” is not some kind of absolute guarantee of code safety

#22
post #4

I am the only one who would have a hard time to collaborate on a project where the "collaborators" start their message with > You need to realize that > (a) reality trumps fantasy ?

Linus is not a “collaborator”.

Sometimes you need to stress the difference betwen “my opinion” (as in “Kernel development requires greater safety standards”) and “facts” (“safety does not exist in software because it does not control the hardware aspect”).

Re: “Rust is safe” is not some kind of absolute guarantee of code safety

#23

Why is panicing in the kernel on an error not an option? Like kernels can write a core dump and reboot, right?

That is a decision taken by Linus. It might have been different but life is choice. This one has been made while Linus is the boss.

Re: “Rust is safe” is not some kind of absolute guarantee of code safety

#24

> Even "safe" rust code in user space will do things like panic when things go wrong (overflows, allocation failures, etc). If you don't realize that that is NOT some kind of true safely, I don't know what to say. When people say "safe" there's a pretty precise meaning and it's not this. Yes, anyone who believes rust is 100% "safe" (by any definition) is wrong. That's not something you learn in Kindergarten though, i…

One of my Marine NCOs would say, "there is no such thing as safe."

You aren't safe on the FOB, in your car, in your barracks, or in your house. There are only degrees of safety. Very wise almost globally applicable words.

Re: “Rust is safe” is not some kind of absolute guarantee of code safety

#25
post #7

> Not completing the operation at all, is not really any better than getting the wrong answer, it's only more debuggable. Wouldn't be that sure about that. Getting the wrong answer can be a serious security problem. Not completing the operation... well, it is not good, but that's it.

The kernel can’t fail to complete its operations, because then the entire system crashes and no logs are created. Instead, you can finish the operation and check the result.

Re: “Rust is safe” is not some kind of absolute guarantee of code safety

#28
post #4

I am the only one who would have a hard time to collaborate on a project where the "collaborators" start their message with > You need to realize that > (a) reality trumps fantasy ?

You need to realise that

(a) that's the creator of Linux (b) see (a) above

Re: “Rust is safe” is not some kind of absolute guarantee of code safety

#30

Not all that familiar with the specifics of Rust, but I assume it’s “safety” is somewhat similar to Swift’s “safety,” so type safety and memory safety, which does not mean no crashes, just that you will e.g. crash on an array OOB error rather than start writing or reading to random bits of memory.

Rust's "safety" is memory safety. It's relatively well defined for a technical term: https://en.wikipedia.org/wiki/Memory_safety edit: > Yeah I was just trying to provide a clear definition, I didn't think you were implying it was BS. (would have replied but I'm rate limited on HN - thanks dang!)

Sorry didn’t mean to imply that it was BS or anything with the scare quotes. More that there is a more specific meaning behind it than some laymen’s interpretation of the word safe.

I know I was a little surprised when I was learning Swift after hearing it was called safe only to experience crashes with array OOB. Took some explanation and thinking to understand what was meant by safe.

Post reply on HN