code format and not setting sanitizers if debug and settings present

This commit is contained in:
van Hauser
2021-01-21 17:15:14 +01:00
parent 43edd969d8
commit b850951c72
6 changed files with 44 additions and 39 deletions

View File

@ -586,9 +586,9 @@ static void edit_params(u32 argc, char **argv, char **envp) {
if (instrument_mode == INSTRUMENT_PCGUARD) {
#if LLVM_MAJOR > 10 || (LLVM_MAJOR == 10 && LLVM_MINOR > 0)
#ifdef __ANDROID__
#ifdef __ANDROID__
cc_params[cc_par_cnt++] = "-fsanitize-coverage=trace-pc-guard";
#else
#else
if (have_instr_list) {
if (!be_quiet)
@ -608,7 +608,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
}
#endif
#endif
#else
#if LLVM_MAJOR >= 4
if (!be_quiet)
@ -1036,7 +1036,7 @@ int main(int argc, char **argv, char **envp) {
#endif
#ifdef __ANDROID__
have_llvm = 1;
have_llvm = 1;
#endif
if ((ptr = find_object("afl-gcc-pass.so", argv[0])) != NULL) {

View File

@ -484,38 +484,41 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
/* Set sane defaults for ASAN if nothing else specified. */
setenv("ASAN_OPTIONS",
"abort_on_error=1:"
"detect_leaks=0:"
"malloc_context_size=0:"
"symbolize=0:"
"allocator_may_return_null=1:"
"handle_segv=0:"
"handle_sigbus=0:"
"handle_abort=0:"
"handle_sigfpe=0:"
"handle_sigill=0",
0);
if (!afl->debug || !getenv("ASAN_OPTIONS"))
setenv("ASAN_OPTIONS",
"abort_on_error=1:"
"detect_leaks=0:"
"malloc_context_size=0:"
"symbolize=0:"
"allocator_may_return_null=1:"
"handle_segv=0:"
"handle_sigbus=0:"
"handle_abort=0:"
"handle_sigfpe=0:"
"handle_sigill=0",
0);
/* Set sane defaults for UBSAN if nothing else specified. */
setenv("UBSAN_OPTIONS",
"halt_on_error=1:"
"abort_on_error=1:"
"malloc_context_size=0:"
"allocator_may_return_null=1:"
"symbolize=0:"
"handle_segv=0:"
"handle_sigbus=0:"
"handle_abort=0:"
"handle_sigfpe=0:"
"handle_sigill=0",
0);
if (!afl->debug || !getenv("UBSAN_OPTIONS"))
setenv("UBSAN_OPTIONS",
"halt_on_error=1:"
"abort_on_error=1:"
"malloc_context_size=0:"
"allocator_may_return_null=1:"
"symbolize=0:"
"handle_segv=0:"
"handle_sigbus=0:"
"handle_abort=0:"
"handle_sigfpe=0:"
"handle_sigill=0",
0);
/* MSAN is tricky, because it doesn't support abort_on_error=1 at this
point. So, we do this in a very hacky way. */
setenv("MSAN_OPTIONS",
if (!afl->debug || !getenv("MSAN_OPTIONS"))
setenv("MSAN_OPTIONS",
"exit_code=" STRINGIFY(MSAN_ERROR) ":"
"symbolize=0:"
"abort_on_error=1:"

View File

@ -700,11 +700,7 @@ save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) {
if (likely(!afl->non_instrumented_mode)) {
if (!classified) {
classify_counts(&afl->fsrv);
}
if (!classified) { classify_counts(&afl->fsrv); }
simplify_trace(afl, afl->fsrv.trace_bits);

View File

@ -60,8 +60,10 @@ void write_setup_file(afl_state_t *afl, u32 argc, char **argv) {
if (i) fprintf(f, " ");
#ifdef __ANDROID__
if (memchr(argv[i], '\'', sizeof(argv[i]))) {
#else
if (index(argv[i], '\'')) {
#endif
fprintf(f, "'");

View File

@ -123,7 +123,8 @@ static void usage(u8 *argv0, int more_help) {
"it.\n"
" if using QEMU, just use -c 0.\n"
" -l cmplog_level - set the complexity/intensivity of CmpLog.\n"
" Values: 1 (integer+string), 2 (+FP) and 3 (+transform)\n\n"
" Values: 1 (integer+string), 2 (+FP) and 3 "
"(+transform)\n\n"
"Fuzzing behavior settings:\n"
" -Z - sequential queue selection instead of weighted "
@ -584,7 +585,8 @@ int main(int argc, char **argv_orig, char **envp) {
if (afl->timeout_given) { FATAL("Multiple -t options not supported"); }
if (!optarg || sscanf(optarg, "%u%c", &afl->fsrv.exec_tmout, &suffix) < 1 ||
if (!optarg ||
sscanf(optarg, "%u%c", &afl->fsrv.exec_tmout, &suffix) < 1 ||
optarg[0] == '-') {
FATAL("Bad syntax used for -t");
@ -766,7 +768,8 @@ int main(int argc, char **argv_orig, char **envp) {
case 'V': {
afl->most_time_key = 1;
if (!optarg || sscanf(optarg, "%llu", &afl->most_time) < 1 || optarg[0] == '-') {
if (!optarg || sscanf(optarg, "%llu", &afl->most_time) < 1 ||
optarg[0] == '-') {
FATAL("Bad syntax used for -V");
@ -777,7 +780,8 @@ int main(int argc, char **argv_orig, char **envp) {
case 'E': {
afl->most_execs_key = 1;
if (!optarg || sscanf(optarg, "%llu", &afl->most_execs) < 1 || optarg[0] == '-') {
if (!optarg || sscanf(optarg, "%llu", &afl->most_execs) < 1 ||
optarg[0] == '-') {
FATAL("Bad syntax used for -E");

View File

@ -252,7 +252,7 @@ static void edit_params(int argc, char **argv) {
int main(int argc, char **argv) {
s32 pid, i, status;
s32 pid, i, status;
char thecwd[PATH_MAX];
if (getenv("AFL_LD_CALLER") != NULL) {