diff --git a/fuzztest/internal/runtime.cc b/fuzztest/internal/runtime.cc index 24e094f2..1b1fd65d 100644 --- a/fuzztest/internal/runtime.cc +++ b/fuzztest/internal/runtime.cc @@ -571,10 +571,14 @@ static void HandleCrash(int signum, siginfo_t* info, void* ucontext) { Runtime& runtime = Runtime::instance(); runtime.SetCrashTypeIfUnset(std::string(it->signame)); const bool has_old_handler = HasCustomHandler(it->action); + bool should_ignore_reporting = false; // SIGTRAP generated by perf_event_open(sigtrap=1) may be used by // debugging/analysis tools, so don't consider these as a crash. - if (!has_old_handler || signum != SIGTRAP || - (info->si_code != TRAP_PERF && info->si_code != SI_TIMER)) { + if (has_old_handler && signum != SIGTRAP && + (info->si_code == TRAP_PERF || info->si_code == SI_TIMER)) { + should_ignore_reporting = true; + } + if (!should_ignore_reporting) { // Dump our info first. runtime.PrintReport(&signal_out_sink); // The old signal handler might print important messages (e.g., strack