Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 1
    I don't think the old architectures would behave that way, the underlying hardware has no way of knowing what memory pages are mmap'ed executable files and which are meant for heap space, unless it is told. Architectures that don't support something like the no-execute flag on pages will always have executable heap, for others, the kernel is the only limitation. Commented Nov 27, 2013 at 20:50
  • 1
    This doesn't seem to be true in 2020, on a 5.8.7 kernel -- compiling the example program does indeed result in a SIGSEV/segfault these days. mprotect doesn't seem to do much. Still trying to figure out why... Commented Sep 8, 2020 at 8:12