Suppressing SIGBUS signals
Suppressing SIGBUS signals
Posted Jun 28, 2021 0:07 UTC (Mon) by izbyshev (guest, #107996)In reply to: Suppressing SIGBUS signals by ocrete
Parent article: Suppressing SIGBUS signals
Yes (the man page says that behavior of MAP_PRIVATE is unspecified if the underlying file changes, but this is what happens on Linux in practice). The ftruncate()-based scenario is only somewhat interesting because it might seem like it only changes the file metadata, but in fact the data in the truncated tail also changes (as observed by mmap() users).
To be clear, the same behavior within the last page of the file is already possible with current kernels: ftruncate() that doesn't remove the last page completely will look like filling its remainder with zeros (though it's also formally unspecified).
So, overall, I don't see how MAP_NOSIGBUS would help with unsafety of Rust's &[u8] referring to mmap()'ed range.
