summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2018-05-01 21:01:53 +0000
committerMatt Morehouse <mascasa@google.com>2018-05-01 21:01:53 +0000
commit42ed860e35e7d30dc37b5dd548eeb7b1cb5dd902 (patch)
treeccb5e69be4a71d5f0cc03def1d2487009b4f0129 /include
parentdcd249132f2d06fb3209b0f965ad1b09ef61feb0 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331310 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/sanitizer/common_interface_defs.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/sanitizer/common_interface_defs.h b/include/sanitizer/common_interface_defs.h
index 6d4326f74..d11cb1add 100644
--- a/include/sanitizer/common_interface_defs.h
+++ b/include/sanitizer/common_interface_defs.h
@@ -65,6 +65,11 @@ extern "C" {
void __sanitizer_unaligned_store32(void *p, uint32_t x);
void __sanitizer_unaligned_store64(void *p, uint64_t x);
+ // Returns 1 on the first call, then returns 0 thereafter. Called by the tool
+ // to ensure only one report is printed when multiple errors occur
+ // simultaneously.
+ int __sanitizer_acquire_crash_state();
+
// Annotate the current state of a contiguous container, such as
// std::vector, std::string or similar.
// A contiguous container is a container that keeps all of its elements