[libFuzzer] Report at most one crash per input.
authorMatt Morehouse <mascasa@google.com>
Tue, 1 May 2018 21:01:53 +0000 (21:01 +0000)
committerMatt Morehouse <mascasa@google.com>
Tue, 1 May 2018 21:01:53 +0000 (21:01 +0000)
commit52fd16903569c0f8c3ca3dfe89d664969739f2f0
treea9f129880c7874b0097db3342c415ae3954c0de5
parentf70671582d6fead1f12ce35ad894db77c51b099a
[libFuzzer] Report at most one crash per input.

Summary:
Fixes https://github.com/google/sanitizers/issues/788/, a deadlock
caused by multiple crashes happening at the same time.  Before printing
a crash report, we now test and set an atomic flag.  If the flag was
already set, the crash handler returns immediately.

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D46277

llvm-svn: 331310
compiler-rt/include/sanitizer/common_interface_defs.h
compiler-rt/lib/asan/asan_report.cc
compiler-rt/lib/fuzzer/FuzzerExtFunctions.def
compiler-rt/lib/fuzzer/FuzzerLoop.cpp
compiler-rt/lib/sanitizer_common/sanitizer_common.cc
compiler-rt/lib/sanitizer_common/sanitizer_common_interface.inc
compiler-rt/lib/sanitizer_common/sanitizer_interface_internal.h
compiler-rt/test/fuzzer/AcquireCrashStateTest.cpp [new file with mode: 0644]
compiler-rt/test/fuzzer/acquire-crash-state.test [new file with mode: 0644]