Suppressing SIGBUS signals
Suppressing SIGBUS signals
Posted Jun 26, 2021 18:02 UTC (Sat) by izbyshev (guest, #107996)In reply to: Suppressing SIGBUS signals by roc
Parent article: Suppressing SIGBUS signals
> Rust safety only requires that &[u8] reference a range of memory that doesn't change and doesn't cause a crash if you access it.
Consider the following sequence of events:
1. Program A maps the file with MAP_PRIVATE | MAP_NOSIGBUS.
2. Program A accesses page P from that file.
3. Program B truncates the file to zero.
4. Page P is evicted from RAM due to memory pressure.
5. Program A accesses page P again.
How is the resulting page fault handled? If a zero-filled page is mapped, then the contents of the range of memory does change silently.