fix UBSAN handling, update docs

This commit is contained in:
hexcoder-
2020-02-16 10:44:53 +01:00
parent b133fa3b6e
commit 37f865ab24
5 changed files with 18 additions and 22 deletions

View File

@ -25,9 +25,8 @@ tools make fairly broad use of environmental variables:
- see [notes_for_asan.md](notes_for_asan.md). - see [notes_for_asan.md](notes_for_asan.md).
(You can also enable MSAN via AFL_USE_MSAN; ASAN and MSAN come with the (You can also enable MSAN via AFL_USE_MSAN; ASAN and MSAN come with the
same gotchas; the modes are mutually exclusive. UBSAN and other exotic same gotchas; the modes are mutually exclusive. UBSAN can be enabled
sanitizers are not officially supported yet, but are easy to get to work similarly by setting the environment variable AFL_USE_UBSAN=1)
by hand.)
- Setting AFL_CC, AFL_CXX, and AFL_AS lets you use alternate downstream - Setting AFL_CC, AFL_CXX, and AFL_AS lets you use alternate downstream
compilation tools, rather than the default 'clang', 'gcc', or 'as' binaries compilation tools, rather than the default 'clang', 'gcc', or 'as' binaries

View File

@ -136,7 +136,8 @@ istruction that will cause SIGILL (ud2 on x86) when an undefined behaviour
is detected. This is the option that you want to use when combining AFL++ is detected. This is the option that you want to use when combining AFL++
and UBSan. and UBSan.
AFL_USE_UBSAN=1 env var will add this compiler flag to afl-clang-fast for you. AFL_USE_UBSAN=1 env var will add this compiler flag to afl-clang-fast,
afl-gcc-fast and afl-gcc for you.
Old versions of UBSAN don't offer a consistent way Old versions of UBSAN don't offer a consistent way
to abort() on fault conditions or to terminate with a distinctive exit code to abort() on fault conditions or to terminate with a distinctive exit code

View File

@ -192,6 +192,8 @@ static void edit_params(u32 argc, char** argv) {
} }
}
if (getenv("AFL_USE_UBSAN")) { if (getenv("AFL_USE_UBSAN")) {
cc_params[cc_par_cnt++] = "-fsanitize=undefined"; cc_params[cc_par_cnt++] = "-fsanitize=undefined";
@ -200,8 +202,6 @@ static void edit_params(u32 argc, char** argv) {
} }
}
if (!getenv("AFL_DONT_OPTIMIZE")) { if (!getenv("AFL_DONT_OPTIMIZE")) {
cc_params[cc_par_cnt++] = "-g"; cc_params[cc_par_cnt++] = "-g";

View File

@ -300,6 +300,8 @@ static void edit_params(u32 argc, char** argv) {
} }
}
if (getenv("AFL_USE_UBSAN")) { if (getenv("AFL_USE_UBSAN")) {
cc_params[cc_par_cnt++] = "-fsanitize=undefined"; cc_params[cc_par_cnt++] = "-fsanitize=undefined";
@ -308,8 +310,6 @@ static void edit_params(u32 argc, char** argv) {
} }
}
#ifdef USE_TRACE_PC #ifdef USE_TRACE_PC
if (getenv("USE_TRACE_PC") || getenv("AFL_USE_TRACE_PC") || if (getenv("USE_TRACE_PC") || getenv("AFL_USE_TRACE_PC") ||

View File

@ -282,8 +282,6 @@ static void edit_params(u32 argc, char** argv) {
} }
if (!asan_set) {
if (getenv("AFL_USE_UBSAN")) { if (getenv("AFL_USE_UBSAN")) {
cc_params[cc_par_cnt++] = "-fsanitize=undefined"; cc_params[cc_par_cnt++] = "-fsanitize=undefined";
@ -292,8 +290,6 @@ static void edit_params(u32 argc, char** argv) {
} }
}
#ifdef USEMMAP #ifdef USEMMAP
cc_params[cc_par_cnt++] = "-lrt"; cc_params[cc_par_cnt++] = "-lrt";
#endif #endif