334 points · by rocky1138 · 9y ago · 30 comments
http://stackoverflow.com/questions/12122446/how-does-c-linki...
And then you might want to skim through An Evil Copy: How the Loader Betrays You:
https://www.microsoft.com/en-us/research/publication/evil-co...
Slightly OT, there was a very fun ActionScript exploit published by Mark Dowd of IBM in 2008. I'm reminded of it because it's about memory protection vulnerabilities.
"Application-Specific Attacks: Leveraging the ActionScript Virtual Machine"
https://docs.oracle.com/cd/E53394_01/html/E54813/glcfv.html#...
https://github.com/sergev/elftoolchain/search?utf8=%E2%9C%93...
Also it is interesting that the powerpc elf loader verifies that the e_ehsize is the same size as the allocated buffer, perhaps they had an issue at one point.
https://github.com/torvalds/linux/blob/ba6d973f78eb62ffebb32...
Thoughts for chapter 2: stuff that often confuses me: PLT, GOT, FDE/CIE.
http://eli.thegreenplace.net/2011/08/25/load-time-relocation...
http://eli.thegreenplace.net/2011/11/03/position-independent...
I think it's specified by itanium C++ ABI (which sounds archaic but actually many other processors use the same one).
I don't recall if these things are ELF features or if the ELF only knows about the "eh_frame" section. It's interesting and kinda sorta related low-level stuff IMO.
Anyone know of something equivalent for Mach-o?
Makes you wonder how ELF's brother (PE) and daughter (WASM) are doing.