diff --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp --- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp @@ -766,6 +766,7 @@ StartRssThread(F, Flags.rss_limit_mb); #endif // LIBFUZZER_EMSCRIPTEN + Options.HandleAlrm = !Flags.minimize_crash; Options.HandleAbrt = Flags.handle_abrt; Options.HandleBus = Flags.handle_bus; Options.HandleFpe = Flags.handle_fpe; diff --git a/compiler-rt/lib/fuzzer/FuzzerOptions.h b/compiler-rt/lib/fuzzer/FuzzerOptions.h --- a/compiler-rt/lib/fuzzer/FuzzerOptions.h +++ b/compiler-rt/lib/fuzzer/FuzzerOptions.h @@ -68,6 +68,7 @@ bool DetectLeaks = true; int PurgeAllocatorIntervalSec = 1; int TraceMalloc = 0; + bool HandleAlrm = false; bool HandleAbrt = false; bool HandleBus = false; bool HandleFpe = false; diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp --- a/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp @@ -354,7 +354,7 @@ Printf("%s", Buf); // Set up alarm handler if needed. - if (Options.UnitTimeoutSec > 0) { + if (Options.HandleAlrm && Options.UnitTimeoutSec > 0) { std::thread T(AlarmHandler, Options.UnitTimeoutSec / 2 + 1); T.detach(); } diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp --- a/compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp @@ -113,7 +113,7 @@ void SetSignalHandler(const FuzzingOptions& Options) { // setitimer is not implemented in emscripten. - if (Options.UnitTimeoutSec > 0 && !LIBFUZZER_EMSCRIPTEN) + if (Options.HandleAlrm && Options.UnitTimeoutSec > 0 && !LIBFUZZER_EMSCRIPTEN) SetTimer(Options.UnitTimeoutSec / 2 + 1); if (Options.HandleInt) SetSigaction(SIGINT, InterruptHandler); diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp --- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp @@ -115,7 +115,7 @@ void SetSignalHandler(const FuzzingOptions& Options) { HandlerOpt = &Options; - if (Options.UnitTimeoutSec > 0) + if (Options.HandleAlrm && Options.UnitTimeoutSec > 0) Timer.SetTimer(Options.UnitTimeoutSec / 2 + 1); if (Options.HandleInt || Options.HandleTerm)