Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc @@ -153,8 +153,16 @@ CheckFailedCallback = callback; } +const int kSecondsToSleepWhenRecursiveCheckFailed = 2; + void NORETURN CheckFailed(const char *file, int line, const char *cond, u64 v1, u64 v2) { + static atomic_uint32_t num_calls; + if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) > 10) { + SleepForSeconds(kSecondsToSleepWhenRecursiveCheckFailed); + Trap(); + } + if (CheckFailedCallback) { CheckFailedCallback(file, line, cond, v1, v2); }