about summary refs log tree commit diff
path: root/examples/afl_untracer/afl-untracer.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/afl_untracer/afl-untracer.c')
-rw-r--r--examples/afl_untracer/afl-untracer.c16
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];