From a72c7cf227638653926a5b43756609e34cc96950 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Mon, 13 Aug 2012 09:57:19 +0000 Subject: [PATCH] [ASan] If ASan finds second error report, wait for some time and die (instead of running in a busy loop) to make sure ASan won't hang if it finds error while reporting an error in the same thread llvm-svn: 161749 --- compiler-rt/lib/asan/asan_report.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler-rt/lib/asan/asan_report.cc b/compiler-rt/lib/asan/asan_report.cc index 51d44bfb96b2..883b84b26a23 100644 --- a/compiler-rt/lib/asan/asan_report.cc +++ b/compiler-rt/lib/asan/asan_report.cc @@ -213,11 +213,11 @@ class ScopedInErrorReport { // they are defined as no-return. AsanReport("AddressSanitizer: while reporting a bug found another one." "Ignoring.\n"); + // We can't use infinite busy loop here, as ASan may try to report an + // error while another error report is being printed (e.g. if the code + // that prints error report for buffer overflow results in SEGV). SleepForSeconds(Max(5, flags()->sleep_before_dying + 1)); - // Try to prevent substituting infinite busy loop with _exit or smth - // like that. - volatile int x = 1; - while (x) { } + Die(); } AsanPrintf("====================================================" "=============\n"); -- GitLab