Re:ELF101 a Linux executable walkthrough
by 1_player on Wednesday November 20, 2013 @06:14AM
(#6767382)
Very nice, too bad there are a few typos.
For example, the "write" function arguments are not ordered correctly and it's using the wrong line terminator. It should be:
[ Parent
| on HN ]
Re:ELF101 a Linux executable walkthrough
by unwind on Wednesday November 20, 2013 @06:44AM
(#6767483)
Uh, if that's supposed to be C, then there's no STDOUT and the way to compute the length of a string is with strlen(), not len(). It should be STDOUT_FILENO as pointed out below.
Re:ELF101 a Linux executable walkthrough
by ange4771_ on Wednesday November 20, 2013 @06:24AM
(#6767408)
thx, will fix it. any other typo ?
Re:ELF101 a Linux executable walkthrough
by lubomir on Wednesday November 20, 2013 @06:33AM
(#6767442)
In code example, the hexdump starts with B9 90 00 00 08, but in the disassembly is listed as 80 00 00 90. I don't think endianness can change 08 to 80.
Re:ELF101 a Linux executable walkthrough
by ange4771_ on Wednesday November 20, 2013 @06:37AM
(#6767458)
not even German endianness ? ;)
thanks for pointing this out.
Re:ELF101 a Linux executable walkthrough
by acc00 on Wednesday November 20, 2013 @06:28AM
(#6767429)
there is no such predefined thing as STDOUT.
you are probably thinking of STDOUT_FILENO. can you just put "1" there?
also, reordering the "mov"s (so they appear in actual call order: edx, ecx, ebx) will simplify the diagram somewhat.