Earlier quoted context omitted.
Linters can catch panics, linters for C won't catch memory issues which is what rust prevents.
Linters like Splint [0] (predating Rust) can do that for C. I’m not saying that Rust’s built-in approach isn’t better, but please be careful about what exactly you claim. [0] http://splint.org/
“Rust is safe” is not some kind of absolute guarantee of code safety
461–470 of 542 posts
Re: “Rust is safe” is not some kind of absolute guarantee of code safety
#462Earlier quoted context omitted.
> Static analysis (Clippy) can get you pretty far. What's funny about this is that (while it's true!) it's exactly the argument that Rustaceans tend to reject out of hand when the subject is hardening C code with analysis tools (or instrumentation gadgets like ASAN/MSAN/fuzzing, which get a lot of the same bile). In fact when used well, my feeling is that extra-language tooling has largely eliminated the practical sa…
Rust makes choices which drastically simplify the analysis problem. The most obvious is mutable references. In Rust there can be either one mutable reference to an object or there may be any number of immutable references. So if we're thinking about this value here, V, and we're got an immutable reference &V so that we can examine V well... it's not changing, there are no mutable references to it by definition. The R…
Re: “Rust is safe” is not some kind of absolute guarantee of code safety
#463Earlier quoted context omitted.
I think you're missing the point Linus made. Panicking is safer from a memory safety perspective, but it's not from a kernel perspective. You'll lose all the file changes that are not saved, you'll risk having disk written in a bad state which can be catastrophic, etc.
Panic corresponds to a potential logic bug. If you have a logic bug, you already risk its consequences even if the panic didn't happen. As long as panic can be caught (and in Rust, it's indeed the case) it is safer than the alternative.
Re: “Rust is safe” is not some kind of absolute guarantee of code safety
#464Earlier quoted context omitted.
I think you're missing the point Linus made. Panicking is safer from a memory safety perspective, but it's not from a kernel perspective. You'll lose all the file changes that are not saved, you'll risk having disk written in a bad state which can be catastrophic, etc.
Panic in Rust need not equate to a literal kernel panic. It can call an oops handler, which might manage to keep the system operational depending on where the failure occurred.
Re: “Rust is safe” is not some kind of absolute guarantee of code safety
#465Earlier quoted context omitted.
The leap second bug would have crashed all nodes of a redundant system, at the same time...
Perhaps. On the other hand, letting a medical device continue moving an actuator or dispensing a medication when it's known to be in a bad "never happen" state could also be fatal. Ditto for the "life support in space" example. Ditto for anything reliant on position, where the system suddenly realizes it has no idea whether its position is correct. Imagine that e.g. on a warship. Limiting responses to external inputs…
At the end of the day, what Linux does is what Linus wants out of it. He's stated, often, that halting the CPU at the exact moment something goes wrong is not the goal. If your goal is to do that, you might not be able to use Linux. If your goal is to put Rust in the Linux kernel, you might have to let go of your goal.
Re: “Rust is safe” is not some kind of absolute guarantee of code safety
#466Earlier quoted context omitted.
Do you know absolutely every medical device in existence and do you know how broad the definition of a medical device is (including e.g. the monitor attached to the PC used for displaying X-ray images)?
I worked in medical device quality control and so, yes, I know all about the FDA requirements for medical devices and ISO 13485. I can say, with certainty, that base Linux would not be allowed to run in a medical device in the USA. It's software of unknown provenance (SOUP) and would absolutely NOT be used as-is.
Re: “Rust is safe” is not some kind of absolute guarantee of code safety
#467Earlier quoted context omitted.
> but Rust also has no built-in mechanism to statically determine “this code won’t ever panic”, My intuition says that's the Halting Problem, so not actually possible to implement perfectly? https://en.wikipedia.org/wiki/Halting_problem
If you are fine with saying that stuff like this code may panic (and many people are fine with just that), then it's perfectly doable if false { panic!() } Basically you'd prohibit any call to panic whether they may actually end up running or not.
But ok, uninformed me would have guessed checking for that would be pretty straightforward in statically typed Rust. Is that something people want? Why isn't there a built-in mechanism to do it?
Re: “Rust is safe” is not some kind of absolute guarantee of code safety
#468Earlier quoted context omitted.
Panic corresponds to a potential logic bug. If you have a logic bug, you already risk its consequences even if the panic didn't happen. As long as panic can be caught (and in Rust, it's indeed the case) it is safer than the alternative.
1. As far as i'm aware there's no way to reliably catch all panics. catch_unwind does not catch all panics. 2. The whole point is that consequences of a panic are worse than the consequences of memory corruption. That's how the kernel was designed. There was an explicit design decision not to kernel panic in every situation where a logic error occurs.
And I thought it was clear that kernel panic is different from Rust panic, which you don't seem to distinguish. Rust panic doesn't need to cause a kernel panic because it can be caught earlier.
Re: “Rust is safe” is not some kind of absolute guarantee of code safety
#469Earlier quoted context omitted.
No I am not referring to that thread. I am referring to the thread further down where someone compares using a memory unsafe language to an illegal activity. If you need an example of the rust community being toxic, I give you https://github.com/actix/actix-web Look up the history and realize they bullied an open source project leader into leaving open source for good.
So this thread? https://news.ycombinator.com/item?id=32879558 I still don't understand the relevance, this neither appears toxic nor to be a discussion of Rust; this looks like they put forward an out-there idea and you didn't care for it, which just seems like a discussion about consumer protection laws. I also don't see the connection from Actix drama to the idea that people are exaggerating the capabilities of Rus…
My understanding is that negative votes is for things that don’t contribute to discussion, yet all my comments are in the negatives except when I mentioned I actually am using rust. Then suddenly the commenter stops talking about our discussion all together and starts to mention learning rust.
It’s frustrating because I like rust, but I can’t seem to criticize it in the slightest.
Re: “Rust is safe” is not some kind of absolute guarantee of code safety
#470Earlier quoted context omitted.
No I am not referring to that thread. I am referring to the thread further down where someone compares using a memory unsafe language to an illegal activity. If you need an example of the rust community being toxic, I give you https://github.com/actix/actix-web Look up the history and realize they bullied an open source project leader into leaving open source for good.
So this thread? https://news.ycombinator.com/item?id=32879558 I still don't understand the relevance, this neither appears toxic nor to be a discussion of Rust; this looks like they put forward an out-there idea and you didn't care for it, which just seems like a discussion about consumer protection laws. I also don't see the connection from Actix drama to the idea that people are exaggerating the capabilities of Rus…
After saying everyone was empowered to use their tool, they tried to kick someone off the team for working for Palantir.
Regardless of politics, kinda unfair to make political statements using the rust accounts, then turn around and say other people can’t be part of rust because they work for a company who is political.