about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2023-12-27 13:53:11 +0100
committervanhauser-thc <vh@thc.org>2023-12-27 13:53:11 +0100
commit1fc1b32db261b27cf14f0d1d7f77a06854b7376c (patch)
tree1b5e241dc505bb251a2603e5072d0a22df0bdf1d /src
parentb01ef97569060bb9f7451d1c2c301b5e774b8358 (diff)
downloadafl++-1fc1b32db261b27cf14f0d1d7f77a06854b7376c.tar.gz
initial simple injection detection support
Diffstat (limited to 'src')
-rw-r--r--src/afl-cc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/afl-cc.c b/src/afl-cc.c
index 22cce2cd..a46facc7 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -1139,6 +1139,26 @@ static void edit_params(u32 argc, char **argv, char **envp) {
 
     }
 
+    if (getenv("AFL_LLVM_INJECTIONS_ALL") ||
+        getenv("AFL_LLVM_INJECTIONS_SQL") ||
+        getenv("AFL_LLVM_INJECTIONS_LDAP") ||
+        getenv("AFL_LLVM_INJECTIONS_XSS")) {
+
+#if LLVM_MAJOR >= 11
+  #if LLVM_MAJOR < 16
+      cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
+  #endif
+      cc_params[cc_par_cnt++] =
+          alloc_printf("-fpass-plugin=%s/injection-pass.so", obj_path);
+#else
+      cc_params[cc_par_cnt++] = "-Xclang";
+      cc_params[cc_par_cnt++] = "-load";
+      cc_params[cc_par_cnt++] = "-Xclang";
+      cc_params[cc_par_cnt++] = alloc_printf("%s/injection-pass.so", obj_path);
+#endif
+
+    }
+
     // cc_params[cc_par_cnt++] = "-Qunused-arguments";
 
   }