aboutsummaryrefslogtreecommitdiff
path: root/llvm_mode
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2020-02-13 21:06:09 +0100
committerhexcoder- <heiko@hexco.de>2020-02-13 21:06:09 +0100
commit24dcc5eb37dcb3c657ceef5fa33b48b1237342f5 (patch)
tree859f35aa7dca7c516d88873f9fec162d7162ea16 /llvm_mode
parentafb23f09cf921d54ef9d11d5fa2a219f824ee025 (diff)
downloadafl++-24dcc5eb37dcb3c657ceef5fa33b48b1237342f5.tar.gz
fix issue #194 more seriously
Diffstat (limited to 'llvm_mode')
-rw-r--r--llvm_mode/LLVMInsTrim.so.cc24
-rw-r--r--llvm_mode/afl-llvm-pass.so.cc22
2 files changed, 35 insertions, 11 deletions
diff --git a/llvm_mode/LLVMInsTrim.so.cc b/llvm_mode/LLVMInsTrim.so.cc
index 5b7b79e1..9f5bf2a7 100644
--- a/llvm_mode/LLVMInsTrim.so.cc
+++ b/llvm_mode/LLVMInsTrim.so.cc
@@ -480,13 +480,25 @@ struct InsTrim : public ModulePass {
}
+ char modeline[100];
+ snprintf(modeline, sizeof(modeline), "%s%s%s%s",
+ getenv("AFL_HARDEN")
+ ? "hardened"
+ : "non-hardened",
+ getenv("AFL_USE_ASAN")
+ ? ", ASAN"
+ : "",
+ getenv("AFL_USE_MSAN")
+ ? ", MSAN"
+ : "",
+ getenv("AFL_USE_UBSAN")
+ ? ", UBSAN"
+ : ""
+ );
+
OKF("Instrumented %u locations (%llu, %llu) (%s mode)\n", total_instr,
- total_rs, total_hs,
- getenv("AFL_HARDEN")
- ? "hardened"
- : ((getenv("AFL_USE_ASAN") || getenv("AFL_USE_MSAN"))
- ? "ASAN/MSAN"
- : "non-hardened"));
+ total_rs, total_hs, modeline);
+
return false;
}
diff --git a/llvm_mode/afl-llvm-pass.so.cc b/llvm_mode/afl-llvm-pass.so.cc
index 2cd23adf..77d63ce4 100644
--- a/llvm_mode/afl-llvm-pass.so.cc
+++ b/llvm_mode/afl-llvm-pass.so.cc
@@ -467,14 +467,26 @@ bool AFLCoverage::runOnModule(Module &M) {
if (!inst_blocks)
WARNF("No instrumentation targets found.");
- else
- OKF("Instrumented %u locations (%s mode, ratio %u%%).", inst_blocks,
+ else {
+ char modeline[100];
+ snprintf(modeline, sizeof(modeline), "%s%s%s%s",
getenv("AFL_HARDEN")
? "hardened"
- : ((getenv("AFL_USE_ASAN") || getenv("AFL_USE_MSAN"))
- ? "ASAN/MSAN"
- : "non-hardened"),
+ : "non-hardened",
+ getenv("AFL_USE_ASAN")
+ ? ", ASAN"
+ : "",
+ getenv("AFL_USE_MSAN")
+ ? ", MSAN"
+ : "",
+ getenv("AFL_USE_UBSAN")
+ ? ", UBSAN"
+ : ""
+ );
+ OKF("Instrumented %u locations (%s mode, ratio %u%%).", inst_blocks,
+ modeline,
inst_ratio);
+ }
}