zlacker

[parent] [thread] 16 comments
1. layer8+(OP)[view] [source] 2022-10-02 16:20:52
One has to be careful about words. When Rust (or Linux) is used in (say) a vehicle or in a nuclear power plant, panicking certainly has immediate safety implications.
replies(2): >>pornel+C >>avgcor+Z2
2. pornel+C[view] [source] 2022-10-02 16:23:39
>>layer8+(OP)
But it can still be safer - e.g. a panic can trigger an emergency stop instead of silently overwriting the "go full throttle" variable.
replies(1): >>mike_h+b6
3. avgcor+Z2[view] [source] 2022-10-02 16:34:30
>>layer8+(OP)
And a perfect, bug-free ballistic rocket program is unsafe in the sense that it is efficient at causing damage.

Rust’s “safety” has always meant what the Rust team meant by that term. There’s no gotcha to be found here except if you can find some way that Rust violates its own definition of the S-word.

This submission is not really about safety. It’s a perfectly legitimate concern that Rust likes to panic and that panicking is inappropriate for Linux. That isn’t about safety per se.

“Safety“ is a very technical term in the PL context and you just end up endlessly bickering if you try to torture the term into certain applications. Is it safer to crash immediately or to continue the program in a corrupted state? That entirely depends on the application and the domain, so it isn’t a useful distinction to make in this context.

EDIT: The best argument one could make from this continue-can-be-safer perspective is that given two PLs, the one that lets you abstract over this decision (to panic or to continue in a corrupted state, preferably with some out of band error reporting) is safer. And maybe C is safer than Rust in that regard (I wouldn’t know).

replies(2): >>layer8+r4 >>goto11+jK1
◧◩
4. layer8+r4[view] [source] [discussion] 2022-10-02 16:41:42
>>avgcor+Z2
That’s exactly my point. Rust’s definition of safety is a very specific one, and one has to be careful about what it actually implies in the context where Rust is employed. “Safety” isn’t a well-defined term for PL in general. “Soundness” is.
replies(2): >>avgcor+nc >>UncleM+dq
◧◩
5. mike_h+b6[view] [source] [discussion] 2022-10-02 16:51:18
>>pornel+C
Yes, or jumping to the "emergency stop" routine can instead trigger "go full throttle" because the jump address has been corrupted.

Or in an actual vehicle, the "emergency stop" (if that means just stomping on the brakes) can flip the car and kill its passengers.

replies(1): >>stjohn+7u
◧◩◪
6. avgcor+nc[view] [source] [discussion] 2022-10-02 17:26:18
>>layer8+r4
Memory safety is a well-defined term.
replies(1): >>layer8+sd
◧◩◪◨
7. layer8+sd[view] [source] [discussion] 2022-10-02 17:30:54
>>avgcor+nc
I agree, but that isn’t the term that was used here, and Rust proponents usually mean more than memory safety by “safe” (like e.g. absence of UB).
replies(2): >>avgcor+dh >>veber-+jX1
◧◩◪◨⬒
8. avgcor+dh[view] [source] [discussion] 2022-10-02 17:50:53
>>layer8+sd
Going through that thread (a few posts back) it seems that “Rust is safe” (as seen in this submission title) was stated first by Torvalds. It wasn’t mentioned first by a “Rust aficianado”. So you would really have to ask Torvalds what he meant. But his mentioning of it (and this submission) obviously alludes to “safe” claims by the Rust project. Which has always been memory safety.
replies(1): >>layer8+Tj
◧◩◪◨⬒⬓
9. layer8+Tj[view] [source] [discussion] 2022-10-02 18:05:58
>>avgcor+dh
I disagree that “safe” as used by the Rust community is always restricted to memory safety, see my parent comment.
◧◩◪
10. UncleM+dq[view] [source] [discussion] 2022-10-02 18:46:00
>>layer8+r4
> “Safety” isn’t a well-defined term for PL in general. “Soundness” is.

This is false. "Safety" and "Liveness" are terms used by the PL field to describe precise properties of programs and they have been used this way for like 50 years (https://en.wikipedia.org/wiki/Safety_and_liveness_properties). A "safety" property describes a guarantee that a program will never reach some form of unwanted state. A "liveness" property describes a guarantee that a program will eventually reach some form of wanted state. These terms would be described very early in a PL course.

replies(1): >>layer8+7P
◧◩◪
11. stjohn+7u[view] [source] [discussion] 2022-10-02 19:12:31
>>mike_h+b6
It's about the odds here. Nothing is 100% safe. Independent systems almost always provide backup safety incase the OS/embedded system fails. Thing like overcurrent detector, brown out detectors, speed governors, etc in case code does something as a result of running corrupted (or something similarly awful)
◧◩◪◨
12. layer8+7P[view] [source] [discussion] 2022-10-02 21:31:48
>>UncleM+dq
What I mean is that there is no universal definition of which properties are safety properties. In principle, you can define any property you can formally reason about as a safety property. Therefore, whenever you talk about safety, you first have to define which properties you mean by that.

In the context of Rust, there are a number of safety properties that Rust guarantees (modulo unsafe, FFI UB, etc.), but that set of safety properties is specific to Rust and not universal. For example, Java has a different set of safety properties, e.g. its memory model gives stronger guarantees than Rust’s.

Therefore, the meaning of “language X is safe” is entirely dependent on the specific language, and can only be understood by explicitly specifying its safety properties.

replies(2): >>avgcor+VQ >>UncleM+PX
◧◩◪◨⬒
13. avgcor+VQ[view] [source] [discussion] 2022-10-02 21:43:56
>>layer8+7P
> Therefore, whenever you talk about safety, you first have to define which properties you mean by that.

Like “memory safety”?

replies(1): >>layer8+iV
◧◩◪◨⬒⬓
14. layer8+iV[view] [source] [discussion] 2022-10-02 22:14:36
>>avgcor+VQ
For example. Rust has other safety properties beyond memory safety.
◧◩◪◨⬒
15. UncleM+PX[view] [source] [discussion] 2022-10-02 22:32:22
>>layer8+7P
That's true for "soundness" too. Things aren't just "sound". They are sound with respect to something. So when you use "soundness" as a comparison against "safety", you'll have to understand how somebody could interpret your post in the way that I did.

Almost all discussion about Rust is in comparison to C and C++, by far the dominant languages for developing native applications. C and C++ are famously neither type-safe nor memory-safe and it becomes a pretty easy shorthand in discussions of Rust for "safety" to refer to these properties.

◧◩
16. goto11+jK1[view] [source] [discussion] 2022-10-03 06:16:11
>>avgcor+Z2
Linus' point is that safety means something different in kernel programming than in PL theory, and that Rust have to be safe according to kernel rules before it can be used for kernel programming.
◧◩◪◨⬒
17. veber-+jX1[view] [source] [discussion] 2022-10-03 08:24:16
>>layer8+sd
absence of UB is literally memory safety.

Rust proponents mean exactly "memory safety" when they say rust is safe because that is the only safety rust guarantees.

[go to top]