Suppressing SIGBUS signals
Suppressing SIGBUS signals
Posted Jun 30, 2021 15:52 UTC (Wed) by miquels (guest, #59247)In reply to: Suppressing SIGBUS signals by roc
Parent article: Suppressing SIGBUS signals
A process that panic()s or crashes on invalid memory accesses is inherently safe, isn't it?
The problem with Rust and mmap is that it just doesn't work if you write from one thread or process and read from another - that's instant UB (Undefined Behaviour) and that is _really_ unsafe.
I think the only safe way to read from or write to mmap'ed memory in Rust is to use atomics - mmap it as AtomicU<whatever> and only read/write using the load/store operations on the atomic values.