[compiler-rt] r335007 - [asan] Avoid deadlock when initializing the symbolizer CHECK fails
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 18 17:36:48 PDT 2018
Author: rnk
Date: Mon Jun 18 17:36:47 2018
New Revision: 335007
URL: http://llvm.org/viewvc/llvm-project?rev=335007&view=rev
Log:
[asan] Avoid deadlock when initializing the symbolizer CHECK fails
Modified:
compiler-rt/trunk/lib/asan/asan_rtl.cc
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=335007&r1=335006&r2=335007&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Mon Jun 18 17:36:47 2018
@@ -66,8 +66,14 @@ static void AsanCheckFailed(const char *
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();
}
More information about the llvm-commits
mailing list