diff options
author | Reid Kleckner <rnk@google.com> | 2018-06-19 00:36:47 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-06-19 00:36:47 +0000 |
commit | d058ad096d473fc8b1a72ed0e69fbc02c900174d (patch) | |
tree | 91f8c9676ef3080a69bc8cc355ef1cc52b61e448 /lib | |
parent | d8e922dbb3e6d80562a4022ca778b6bb188e50b2 (diff) |
[asan] Avoid deadlock when initializing the symbolizer CHECK fails
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335007 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/asan/asan_rtl.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc index 15b5035e6..4cff736f2 100644 --- a/lib/asan/asan_rtl.cc +++ b/lib/asan/asan_rtl.cc @@ -66,8 +66,14 @@ static void AsanCheckFailed(const char *file, int line, const char *cond, u64 v1, u64 v2) { Report("AddressSanitizer CHECK failed: %s:%d \"%s\" (0x%zx, 0x%zx)\n", file, line, cond, (uptr)v1, (uptr)v2); - // FIXME: check for infinite recursion without a thread-local counter here. - PRINT_CURRENT_STACK_CHECK(); + + // Print a stack trace the first time we come here. Otherwise, we probably + // failed a CHECK during symbolization. + static atomic_uint32_t num_calls; + if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) == 0) { + PRINT_CURRENT_STACK_CHECK(); + } + Die(); } |