11 comments

[ 24.7 ms ] story [ 2343 ms ] thread
Another ELF diagram also made the rounds a few years ago: https://code.google.com/p/corkami/wiki/ELF101

It's more of a 1-page poster and doesn't have the longer explanations in the submitted github article.

I was hoping someone would post this, because I had lost the bookmark! Thanks!
The last sentence of the first paragraph really struck me

>In general, no single section has both write and execute permissions as this could compromise the security of the system.

Is that actually enforced in modern linux kernels? I thought it would be possible to call

    mmap(..., PROT_READ | PROT_WRITE | PROT_EXEC, ...)
If this ever gets enforced it could be annoying for software that generates code at runtime, which may require quick access to some run-time data for particular instructions. It may be useful to force huge pages for dynamically generated code to improve pressure on the TLB. It can slow down code generation if the pages with code in it have to be converted to write and then converted back to execute every time a new bit of dynamic code gets added. Additionally, if the generated code instructions require access to a bit of dynamic data, it may not be able to actually reach a separate data page using immediate offsets to pc on some architectures (e.g. ARM).