Skip to content

Commit c8e9bc0

Browse files
committed
RUDRA
1 parent ebc0fb2 commit c8e9bc0

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

content/lessons/15_unsafe/index.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ In the following code sample, we show all superpowers of `unsafe` code:
3535

3636
## Safe code guarantees
3737

38-
Safe code may **_never_** cause Undefined Behaviour.
38+
The single fundamental property of Safe Rust, _the soundness property_:
39+
40+
**No matter what, Safe Rust can't cause Undefined Behavior.**
3941

4042
This is a valid _sound_ code, with a safe encapsulation over `unsafe` interior.
4143

@@ -75,3 +77,15 @@ But we only changed safe code! This shows that `unsafe` is unfortunately not per
7577
- [The Rustonomicon](https://doc.rust-lang.org/nomicon/), especially chapter 1 _(Meet Safe and Unsafe)_
7678

7779
- [How unpleasant is Unsafe Rust?](https://www.reddit.com/r/rust/comments/16i8lo2/how_unpleasant_is_unsafe_rust/)
80+
81+
- [RUDRA: Finding Memory Safety Bugs in Rust at the Ecosystem Scale](https://taesoo.kim/pubs/2021/bae:rudra.pdf) - automatic static analyzer to find 3 most frequent subtle bugs in `unsafe` code:
82+
83+
1. panic (unwind) safety bug (analogous to exception-handling guarantees in C++),
84+
2. higher-order safety invariant (assuming certain properties of the type that the generic is instantiated with that are not guaranteed by the type system, e.g., _purity_),
85+
3. propagating Send/Sync in Generic Types (implementing Send/Sync unconditionally for T, even if T contains non-Send/non-Sync types inside).
86+
87+
**RUDRA found 264 previously unknown memory-safety bugs in 145 packages on crates.io!!!**
88+
89+
Is Rust really a safe language...?
90+
91+
Only transitively. _Safe Rust_ is sound iff `unsafe` code called by it is sound too.

0 commit comments

Comments
 (0)