4 ms·
Seg fault!
by johnea 3y ago
Seg fault!
- pizzalife 3y agoNot if you map it first.
- deathanatos 3y agoI believe Linux (only in later versions; and a few other OSes) make this page unmappable[1]. That, of course, would be part of the talk: that this is perhaps an OS-specific feature that the original coder was maybe trying to trigger, and that it is still OS-dependent. [1]: https://en.wikipedia.org/wiki/Zero_page https://en.wikipedia.org/wiki/Zero_page states this to be the case, but mmap(2) seems to disagree / suggests 0 is mappable.
- pizzalife 3y agoBy default you can only map addresses over 65536 (root can map anything though). But you can disable the protections with: echo 0 > /proc/sys/vm/mmap_min_addr
- jenadine 3y agoThat's what I intended when I used it (with an extra 'volatile'). My objective was to test the crash reporter tool.
- olliej 3y agoOr alternatively, dereferencing null is UB, so the compiler can elide it (or the path that leads to it)