ubsan options

This commit is contained in:
Andrea Fioraldi
2020-07-03 10:20:10 +02:00
parent 509b991607
commit 139665c01d
4 changed files with 105 additions and 11 deletions

View File

@ -772,15 +772,38 @@ static void set_up_environment(void) {
setenv("ASAN_OPTIONS", setenv("ASAN_OPTIONS",
"abort_on_error=1:" "abort_on_error=1:"
"detect_leaks=0:" "detect_leaks=0:"
"allocator_may_return_null=1:"
"symbolize=0:" "symbolize=0:"
"allocator_may_return_null=1", "handle_segv=0:"
"handle_sigbus=0:"
"handle_abort=0:"
"handle_sigfpe=0:"
"handle_sigill=0",
0);
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); 0);
setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":" setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":"
"symbolize=0:"
"abort_on_error=1:" "abort_on_error=1:"
"msan_track_origins=0"
"allocator_may_return_null=1:" "allocator_may_return_null=1:"
"msan_track_origins=0", 0); "symbolize=0:"
"handle_segv=0:"
"handle_sigbus=0:"
"handle_abort=0:"
"handle_sigfpe=0:"
"handle_sigill=0", 0);
if (get_afl_env("AFL_PRELOAD")) { if (get_afl_env("AFL_PRELOAD")) {

View File

@ -434,7 +434,27 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
"detect_leaks=0:" "detect_leaks=0:"
"malloc_context_size=0:" "malloc_context_size=0:"
"symbolize=0:" "symbolize=0:"
"allocator_may_return_null=1", "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); 0);
/* MSAN is tricky, because it doesn't support abort_on_error=1 at this /* MSAN is tricky, because it doesn't support abort_on_error=1 at this
@ -446,7 +466,12 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
"abort_on_error=1:" "abort_on_error=1:"
"malloc_context_size=0:" "malloc_context_size=0:"
"allocator_may_return_null=1:" "allocator_may_return_null=1:"
"msan_track_origins=0", "msan_track_origins=0:"
"handle_segv=0:"
"handle_sigbus=0:"
"handle_abort=0:"
"handle_sigfpe=0:"
"handle_sigill=0",
0); 0);
fsrv->init_child_func(fsrv, argv); fsrv->init_child_func(fsrv, argv);

View File

@ -456,15 +456,38 @@ static void set_up_environment(afl_forkserver_t *fsrv) {
setenv("ASAN_OPTIONS", setenv("ASAN_OPTIONS",
"abort_on_error=1:" "abort_on_error=1:"
"detect_leaks=0:" "detect_leaks=0:"
"allocator_may_return_null=1:"
"symbolize=0:" "symbolize=0:"
"allocator_may_return_null=1", "handle_segv=0:"
"handle_sigbus=0:"
"handle_abort=0:"
"handle_sigfpe=0:"
"handle_sigill=0",
0);
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); 0);
setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":" setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":"
"symbolize=0:"
"abort_on_error=1:" "abort_on_error=1:"
"msan_track_origins=0"
"allocator_may_return_null=1:" "allocator_may_return_null=1:"
"msan_track_origins=0", 0); "symbolize=0:"
"handle_segv=0:"
"handle_sigbus=0:"
"handle_abort=0:"
"handle_sigfpe=0:"
"handle_sigill=0", 0);
if (get_afl_env("AFL_PRELOAD")) { if (get_afl_env("AFL_PRELOAD")) {

View File

@ -701,15 +701,38 @@ static void set_up_environment(afl_forkserver_t *fsrv) {
setenv("ASAN_OPTIONS", setenv("ASAN_OPTIONS",
"abort_on_error=1:" "abort_on_error=1:"
"detect_leaks=0:" "detect_leaks=0:"
"allocator_may_return_null=1:"
"symbolize=0:" "symbolize=0:"
"allocator_may_return_null=1", "handle_segv=0:"
"handle_sigbus=0:"
"handle_abort=0:"
"handle_sigfpe=0:"
"handle_sigill=0",
0);
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); 0);
setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":" setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":"
"symbolize=0:"
"abort_on_error=1:" "abort_on_error=1:"
"msan_track_origins=0"
"allocator_may_return_null=1:" "allocator_may_return_null=1:"
"msan_track_origins=0", 0); "symbolize=0:"
"handle_segv=0:"
"handle_sigbus=0:"
"handle_abort=0:"
"handle_sigfpe=0:"
"handle_sigill=0", 0);
if (get_afl_env("AFL_PRELOAD")) { if (get_afl_env("AFL_PRELOAD")) {