diff options
author | van Hauser <vh@thc.org> | 2020-05-01 17:07:44 +0200 |
---|---|---|
committer | van Hauser <vh@thc.org> | 2020-05-01 17:07:44 +0200 |
commit | 33ddf6ea0e090ec2ef18dfa7c53b4dfe8130de26 (patch) | |
tree | 0f4587c8a74e1cd60272738313747d4e5f16f3cb /examples/afl_untracer/afl-untracer.c | |
parent | a2bc3538f746b1e8f1c7b474b3a7b1fcc332998e (diff) | |
download | afl++-33ddf6ea0e090ec2ef18dfa7c53b4dfe8130de26.tar.gz |
add ghidra script and workaround ghidra/linux/ida weirdness
Diffstat (limited to 'examples/afl_untracer/afl-untracer.c')
-rw-r--r-- | examples/afl_untracer/afl-untracer.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/examples/afl_untracer/afl-untracer.c b/examples/afl_untracer/afl-untracer.c index 5338bfd5..f812958c 100644 --- a/examples/afl_untracer/afl-untracer.c +++ b/examples/afl_untracer/afl-untracer.c @@ -506,18 +506,6 @@ void setup_trap_instrumentation() { // It's an offset, parse it and do the patching. unsigned long offset = strtoul(line, NULL, 16); - // I dont know what it is. /proc/<pid>/maps shows the right start address - // and the offsets generated by the python scripts are fine as well. - // And loading the library into gdb also shows the offsets generated - // by the script are correct. However when loaded via dlopen the first - // 0x1000 are skipped ... -#if defined(__linux__) - if (offset >= 0x1000) - offset -= 0x1000; - else - fprintf(stderr, "Warning: offset is < 0x1000: %x\n", offset); -#endif - if (offset > lib_size) FATAL("Invalid offset: 0x%lx. Current library is 0x%zx bytes large", offset, lib_size); @@ -526,10 +514,12 @@ void setup_trap_instrumentation() { FATAL("Too many basic blocks to instrument"); uint32_t *shadow = SHADOW(lib_addr + offset); - if (*shadow != 0) FATAL("Duplicate patch entry: 0x%lx", offset); + if (*shadow != 0) continue; // skip duplicates // Make lookup entry in shadow memory. + #if ((defined(__APPLE__) && defined(__LP64__)) || defined(__x86_64__)) + // this is for Intel x64 uint8_t orig_byte = lib_addr[offset]; |