Does Rust have pointer operations that are "constrained UB" on data races?
I'm writing a crash dumper that has to read arbitrary memory. In practice, that memory should be static after a crash, but for safety, let's assume it might not be. Rust's std::ptr says that it is UB to perform concurrent accesses, even when using read_volatile. But is this really "dragons come out your nose" UB, or just "the data may tear / be anything" UB? Even Atomic types say "it is not allowed to mix atomic and non-atomic accesses".
I'm pretty sure I can just use atomics anyway and it will work (and atomic loads with relaxed memory model should just map to regular loads anyway), but it's still UB on paper.
Is there anything left in Rust core? Or do I have to write assembly code to be strictly compliant-with-the-spec?
https://vt.social/@lina/113624570979218201
https://doc.rust-lang.org/std/ptr/index.html
https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU8.html#method.from_ptr
@lina I think read_volatile is fine, since the doc for that says "That being said, the semantics will almost always end up pretty similar to C11’s definition of volatile."
which is also what […]
────