From dcf7d85cba9a8ee5a33cff578fe48bdbccda1a3d Mon Sep 17 00:00:00 2001 From: van Hauser Date: Mon, 9 Mar 2020 10:56:53 +0100 Subject: honor no_quiet for missing llvm_mode output, also print to stderr with afl-*-rt.o.c instead of stdout for errors plus two potential bad free() fixes --- llvm_mode/LLVMInsTrim.so.cc | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'llvm_mode/LLVMInsTrim.so.cc') diff --git a/llvm_mode/LLVMInsTrim.so.cc b/llvm_mode/LLVMInsTrim.so.cc index 390e0697..8127c893 100644 --- a/llvm_mode/LLVMInsTrim.so.cc +++ b/llvm_mode/LLVMInsTrim.so.cc @@ -142,7 +142,7 @@ struct InsTrim : public ModulePass { #if LLVM_VERSION_MAJOR < 9 char *neverZero_counters_str; if ((neverZero_counters_str = getenv("AFL_LLVM_NOT_ZERO")) != NULL) - OKF("LLVM neverZero activated (by hexcoder)\n"); + if (!be_quiet) OKF("LLVM neverZero activated (by hexcoder)\n"); #endif if (getenv("AFL_LLVM_INSTRIM_LOOPHEAD") != NULL || @@ -523,15 +523,19 @@ 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" : ""); + if (!be_quiet) { - OKF("Instrumented %u locations (%llu, %llu) (%s mode)\n", total_instr, - total_rs, total_hs, modeline); + 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, modeline); + + } return false; -- cgit 1.4.1