--- Log opened Fri Aug 16 00:00:36 2013 | ||
-!- jeremybennett_ [~jeremy@188.29.150.181.threembb.co.uk] has joined #mageec | 10:53 | |
-!- mode/#mageec [+o jeremybennett_] by ChanServ | 10:53 | |
-!- jeremybennett_ [~jeremy@188.29.150.181.threembb.co.uk] has quit [Ping timeout: 245 seconds] | 12:07 | |
@simoncook | AWhetter: jamespallister: I have some test hash code could you try, http://simoncook.org/tmp/elf.c I've been compling with 'gcc -g elf.c -lelf -lgcrypt' so you need headers for libelf and libgcrypt. Then run with ./a.out <some binary> | 14:54 |
---|---|---|
AWhetter | simoncook: I needed to change "/tmp/a.out" on line 34 to argv[1], but it works for me with an ARM binary and an x86 binary | 15:00 |
AWhetter | It also works on itself :P | 15:02 |
@simoncook | aah, i added the check for if you added an argument but never used it ^^ | 15:10 |
@simoncook | excellent, so something like that might be used to give you your binary key for your database entry (we just need to decide what sections to use/not use) | 15:11 |
jamespallister | Yeh, this looks good | 15:25 |
jamespallister | perhaps instead of explicity looking for .data or .text, look for sections marked loadable? | 15:26 |
jamespallister | also the offset of each section, and the start address of the executable might need to be in the hash | 15:27 |
@simoncook | so for each loadable section, add its header? | 15:28 |
jamespallister | what else is in the header? | 15:28 |
jamespallister | Everything except the file offset? | 15:30 |
jamespallister | and the link to the next header | 15:30 |
@simoncook | Actually maybe just what you suggested, as sh_name is an offset, so that might change, so perhaps just loadaddress, flags | 15:32 |
@simoncook | if you change line 73 to "if (sechdr.sh_type & SHF_ALLOC) {" does that seem right with a few files | 15:46 |
jamespallister | hmm | 15:49 |
jamespallister | its hashing the symtab and strtabl | 15:49 |
@simoncook | I'm thinking have a blacklist function to ignore sections based on their name | 15:50 |
@simoncook | so loadable and not (.foo or .bar) | 15:51 |
jamespallister | it also doesn't pick up .text for some reason | 15:56 |
jamespallister | or .data | 15:57 |
@simoncook | oops, fail on my part, try sh_flags instead of sh_type | 15:58 |
jamespallister | heh, now it segfaults | 16:00 |
jamespallister | ah yes | 16:02 |
@simoncook | aah, yes, that because its trying to copy .bss of size n from nowhere | 16:02 |
jamespallister | sometimes elfdata->d_buf is NULL, even though it hash a elfdata->d_size > 0 | 16:02 |
jamespallister | *has | 16:03 |
jamespallister | NULL check? ^_^ | 16:03 |
@simoncook | the version I have after giving you a link has a size check, obviously missed the NULL ^^ | 16:04 |
@simoncook | the version at that link now has all the fixes/changes so far | 16:06 |
jamespallister | cool, looks good | 16:08 |
jamespallister | perhaps add dummy 0s for .bss ? | 16:08 |
jamespallister | zeroing out a larger area of memory could potentially affect energy usage | 16:09 |
jamespallister | so we'd want a different hash | 16:09 |
@simoncook | i was thinking im going to dump its size in there anywhere (code not there yet) so is there a point? | 16:10 |
jamespallister | that should be fine | 16:10 |
-!- jeremybennett_ [~jeremy@87.115.177.203] has joined #mageec | 19:50 | |
-!- mode/#mageec [+o jeremybennett_] by ChanServ | 19:50 | |
-!- jeremybennett_ [~jeremy@87.115.177.203] has quit [Ping timeout: 264 seconds] | 20:03 | |
-!- jeremybennett_ [~jeremy@176.33.112.87.dyn.plus.net] has joined #mageec | 20:05 | |
-!- mode/#mageec [+o jeremybennett_] by ChanServ | 20:05 | |
-!- jeremybennett_ [~jeremy@176.33.112.87.dyn.plus.net] has quit [Ping timeout: 246 seconds] | 20:13 | |
--- Log closed Sat Aug 17 00:00:42 2013 |
Generated by irclog2html.py 2.12.1 by Marius Gedminas - find it at mg.pov.lt!