mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 11:08:06 +00:00
fix issue #194 more seriously
This commit is contained in:
@ -192,6 +192,14 @@ static void edit_params(u32 argc, char** argv) {
|
||||
|
||||
}
|
||||
|
||||
if (getenv("AFL_USE_UBSAN")) {
|
||||
|
||||
cc_params[cc_par_cnt++] = "-fsanitize=undefined";
|
||||
cc_params[cc_par_cnt++] = "-fsanitize-undefined-trap-on-error";
|
||||
cc_params[cc_par_cnt++] = "-fno-sanitize-recover=all";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!getenv("AFL_DONT_OPTIMIZE")) {
|
||||
|
@ -480,13 +480,25 @@ struct InsTrim : public ModulePass {
|
||||
|
||||
}
|
||||
|
||||
OKF("Instrumented %u locations (%llu, %llu) (%s mode)\n", total_instr,
|
||||
total_rs, total_hs,
|
||||
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 (%llu, %llu) (%s mode)\n", total_instr,
|
||||
total_rs, total_hs, modeline);
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
23
src/afl-as.c
23
src/afl-as.c
@ -478,13 +478,28 @@ static void add_instrumentation(void) {
|
||||
if (!ins_lines)
|
||||
WARNF("No instrumentation targets found%s.",
|
||||
pass_thru ? " (pass-thru mode)" : "");
|
||||
else
|
||||
else {
|
||||
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 (%s-bit, %s mode, ratio %u%%).", ins_lines,
|
||||
use_64bit ? "64" : "32",
|
||||
getenv("AFL_HARDEN") ? "hardened"
|
||||
: (sanitizer ? "ASAN/MSAN" : "non-hardened"),
|
||||
modeline,
|
||||
inst_ratio);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -282,6 +282,18 @@ static void edit_params(u32 argc, char** argv) {
|
||||
|
||||
}
|
||||
|
||||
if (!asan_set) {
|
||||
|
||||
if (getenv("AFL_USE_UBSAN")) {
|
||||
|
||||
cc_params[cc_par_cnt++] = "-fsanitize=undefined";
|
||||
cc_params[cc_par_cnt++] = "-fsanitize-undefined-trap-on-error";
|
||||
cc_params[cc_par_cnt++] = "-fno-sanitize-recover=all";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef USEMMAP
|
||||
cc_params[cc_par_cnt++] = "-lrt";
|
||||
#endif
|
||||
|
@ -43,6 +43,7 @@ unset AFL_DEBUG
|
||||
unset AFL_HARDEN
|
||||
unset AFL_USE_ASAN
|
||||
unset AFL_USE_MSAN
|
||||
unset AFL_USE_UBSAN
|
||||
unset AFL_CC
|
||||
unset AFL_PRELOAD
|
||||
unset AFL_GCC_WHITELIST
|
||||
|
Reference in New Issue
Block a user