summaryrefslogtreecommitdiff
path: root/compiler-rt/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
commit55cb88a5d54991fdeef6ebec5be03d02fb5561e8 (patch)
tree1de8beb6f5657b10361f3a08be8066e05ba39e52 /compiler-rt/include
parent750c2ff5fbf5cd4688e51f72e12a98b50de29282 (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
Diffstat (limited to 'compiler-rt/include')
-rw-r--r--compiler-rt/include/sanitizer/common_interface_defs.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler-rt/include/sanitizer/common_interface_defs.h b/compiler-rt/include/sanitizer/common_interface_defs.h
index 6d4326f7402..d11cb1addc2 100644
--- a/compiler-rt/include/sanitizer/common_interface_defs.h
+++ b/compiler-rt/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