about summary refs log tree commit diff
path: root/instrumentation/afl-compiler-rt.o.c
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-12-03 10:02:57 +0100
committervanhauser-thc <vh@thc.org>2021-12-03 10:02:57 +0100
commita915c05740089890ce38a7809d3252116d1f4fb2 (patch)
tree6d234b444dcba20579464674a56a9f986eecd0f4 /instrumentation/afl-compiler-rt.o.c
parent86dae0b16a0e4e8f4740e3abb5df15bb868c2337 (diff)
downloadafl++-a915c05740089890ce38a7809d3252116d1f4fb2.tar.gz
what to do with dlopen libs?
Diffstat (limited to 'instrumentation/afl-compiler-rt.o.c')
-rw-r--r--instrumentation/afl-compiler-rt.o.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c
index cc73e5ec..65dafb8c 100644
--- a/instrumentation/afl-compiler-rt.o.c
+++ b/instrumentation/afl-compiler-rt.o.c
@@ -1417,6 +1417,20 @@ void __sanitizer_cov_trace_pc_guard_init(uint32_t *start, uint32_t *stop) {
 
   if (start == stop || *start) return;
 
+  // If a dlopen of an instrumented library happens after the forkserver then
+  // we have a problem.
+  // Should we abort()? This way a user would/could find out.
+  // Currently we just do not instrument that lib, which is invisible.
+  if (__afl_already_initialized_forkserver) {
+
+    fprintf(stderr,
+            "[-] ERROR: forkserver is already up, but an instrumented dlopen() "
+            "library loaded afterwards. You must LD_PRELOAD such libraries to "
+            "be able to fuzz them.\n");
+    return;  // or should be abort()?
+
+  }
+
   x = getenv("AFL_INST_RATIO");
   if (x) inst_ratio = (u32)atoi(x);