Re:The Shortest Crashing C Program
by lgeek on Friday May 24, 2013 @12:06PM
(#5763727)
You're right about this. On my GNU/Linux machine, main is in the data segment. The process receives a segfault for trying to execute from a page marked as not executable.
If we are to mark the data segment as executable (quite easy for ELF), we can see execution starting at &main and continuing until end of the page and then segfaulting for trying to execute from an unmapped virtual address.
If we change the source to main=0xC3; as per your suggestion and we mark the data segment as executable, the program exits correctly (but with an exit status we don't control).
[ Parent
| on HN ]
There are no comments on this comment yet.