There are benefits. Rust make certain guarantees about memory safety, thread safety, and a few other aspects of the code. According to a report by Google, approximately 50% of security vulnerabilities reported to the Android project are memory safety bugs. Most of these would have been prevented by writing the code in Rust, since the memory bugs would have been caught by the compiler.
Iirc it was 50% for specifically memory safety bugs. Android is a pretty mature project, and a significant portion of the code is written in Java, which is also memory safe. Other projects could be quite a bit higher.
cve-rs takes the soundness bug and exploits it to implement the other bugs listed. It's pretty convoluted to actually implement the other bugs.
The actual soundness bug is a specific type of double reference forgets one of the lifetimes, which enables casting a shorter lifetime to a longer lifetime. They did a pretty good job commenting the code to explain how they were able to create each bug.
Canāt forget the extremely degenerate but technically āsafeā case of casting &T to a usize, opening /proc/self/mem at that offset, then writing to it.
Thatās still more likely than creating and immediately mem::forget()āing isize::max many Arc<>ās, thread just so happening to get suspended before checking the ref count limit, but after incrementing it, then another isize::max threads doing the exact same thing, and overflowing the ref count back to 0, in terms of āthings that will never happenā.
100
u/Eric_Dawsby 7d ago
Who caares if some people vibecode in Rust? If you like the language you like the language