about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2020-02-13 20:37:00 +0100
committerAndrea Fioraldi <andreafioraldi@gmail.com>2020-02-13 20:37:00 +0100
commit99b2adcbe20a3e823170cf5668bf949e98e7f8b1 (patch)
treee8ea94b074d2ac780ecf1a760618a38affcc7f39
parent12df4c4af7b7bf394fa92d40c6b3509da97d556d (diff)
downloadafl++-99b2adcbe20a3e823170cf5668bf949e98e7f8b1.tar.gz
solve #194
-rw-r--r--llvm_mode/afl-llvm-pass.so.cc35
1 files changed, 27 insertions, 8 deletions
diff --git a/llvm_mode/afl-llvm-pass.so.cc b/llvm_mode/afl-llvm-pass.so.cc
index 2cd23adf..7d5cb224 100644
--- a/llvm_mode/afl-llvm-pass.so.cc
+++ b/llvm_mode/afl-llvm-pass.so.cc
@@ -467,14 +467,33 @@ bool AFLCoverage::runOnModule(Module &M) {
 
     if (!inst_blocks)
       WARNF("No instrumentation targets found.");
-    else
-      OKF("Instrumented %u locations (%s mode, ratio %u%%).", inst_blocks,
-          getenv("AFL_HARDEN")
-              ? "hardened"
-              : ((getenv("AFL_USE_ASAN") || getenv("AFL_USE_MSAN"))
-                     ? "ASAN/MSAN"
-                     : "non-hardened"),
-          inst_ratio);
+    else {
+      char mode[64];
+      int not_hardened = 1;
+      if (getenv("AFL_HARDEN")) {
+        strcat(mode, "/hardened");
+        not_hardened = 0;
+      }      
+      if (getenv("AFL_USE_ASAN")) {
+        strcat(mode, "/ASAN");
+        not_hardened = 0;
+      }
+      if (getenv("AFL_USE_MSAN")) {
+        strcat(mode, "/MSAN");
+        not_hardened = 0;
+      }
+      if (getenv("AFL_USE_UBSAN")) {
+        strcat(mode, "/UNSAN");
+        not_hardened = 0;
+      }
+      
+      if (not_hardened)
+        OKF("Instrumented %u locations (non-hardened mode, ratio %u%%).",
+            inst_blocks, inst_ratio);
+      else
+        OKF("Instrumented %u locations (%s mode, ratio %u%%).", inst_blocks,
+            &mode[1], inst_ratio);
+    }
 
   }