From bbb8522bdeff73488b772bcf71c450559b9d5626 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Fri, 19 Apr 2019 01:39:14 +0000 Subject: [PATCH] [libFuzzer] in fork mode, make sure the child stats are always collected. This should fix the flakiness in fork-ubsan.test llvm-svn: 358726 --- compiler-rt/lib/fuzzer/CMakeLists.txt | 1 + compiler-rt/lib/fuzzer/FuzzerFork.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/fuzzer/CMakeLists.txt b/compiler-rt/lib/fuzzer/CMakeLists.txt index aa62995..f473910 100644 --- a/compiler-rt/lib/fuzzer/CMakeLists.txt +++ b/compiler-rt/lib/fuzzer/CMakeLists.txt @@ -66,6 +66,7 @@ elseif(TARGET cxx-headers OR HAVE_LIBCXX) endif() append_list_if(COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG -fno-omit-frame-pointer LIBFUZZER_CFLAGS) +append_list_if(True -fexceptions LIBFUZZER_CFLAGS) if (CMAKE_CXX_FLAGS MATCHES "fsanitize-coverage") list(APPEND LIBFUZZER_CFLAGS -fno-sanitize-coverage=trace-pc-guard,edge,trace-cmp,indirect-calls,8bit-counters) diff --git a/compiler-rt/lib/fuzzer/FuzzerFork.cpp b/compiler-rt/lib/fuzzer/FuzzerFork.cpp index 3d85beb..9d338aa 100644 --- a/compiler-rt/lib/fuzzer/FuzzerFork.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerFork.cpp @@ -150,6 +150,9 @@ struct GlobalEnv { } void RunOneMergeJob(FuzzJob *Job) { + auto Stats = ParseFinalStatsFromLog(Job->LogPath); + NumRuns += Stats.number_of_executed_units; + Vector TempFiles, MergeCandidates; // Read all newly created inputs and their feature sets. // Choose only those inputs that have new features. @@ -189,8 +192,6 @@ struct GlobalEnv { PrintPC(" NEW_FUNC: %p %F %L\n", "", TPC.GetNextInstructionPc(TE->PC)); - auto Stats = ParseFinalStatsFromLog(Job->LogPath); - NumRuns += Stats.number_of_executed_units; if (!FilesToAdd.empty() || Job->ExitCode != 0) Printf("#%zd: cov: %zd ft: %zd corp: %zd exec/s %zd " "oom/timeout/crash: %zd/%zd/%zd time: %zds\n", NumRuns, -- 2.7.4