4 ms·
Without compiler bugs, on stock Linux, you can achieve the same thing via /proc/self/mem. Rust makes this very easy because you can get the raw address from saf
by fweimer 3y ago
Without compiler bugs, on stock Linux, you can achieve the same thing via /proc/self/mem. Rust makes this very easy because you can get the raw address from safe code, so no guessing is required which memory location to patch.
For the compiler bug, as someone who never strayed into those regions of Rust programming, it's not clear to me how likely it is that someone would write such code by accident and introduce a memory safety issue into their program. I browsed the Github issues, but couldn't find an indicator how people encountered this in the first place.
- jcmoyer 3y ago>Without compiler bugs, on stock Linux, you can achieve the same thing via /proc/self/mem. The documentation addresses this case specifically: https://doc.rust-lang.org/stable/std/os/unix/io/index.html#procselfmem-and-similar-os-features https://doc.rust-lang.org/stable/std/os/unix/io/index.html#p... "Rust’s safety guarantees only cover what the program itself can do, and not what entities outside the program can do to it. /proc/self/mem is considered to be such an external entity..."
- fweimer 3y agoThe /proc/self/mem thing shouldn't be a problem because you won't run into it accidentally. What I'm wondering if this compiler bug is in the same category, or if a Rust programmer is somewhat likely to run into this bug by accident (or other I-unsound compiler bugs) if their approach is more or less “tweak things until they typecheck and pass the borrow checker”.
- steveklabnik 3y agoI have been programming in Rust since late 2012. I don’t think I have ever run into a soundness bug like this in the wild. That doesn’t mean that it never happens, but it is a very rare occurrence, not something that Rust programmers deal with regularly.