[llvm-commits] [compiler-rt] r161749 - /compiler-rt/trunk/lib/asan/asan_report.cc

Alexey Samsonov samsonov at google.com
Mon Aug 13 02:57:19 PDT 2012


Author: samsonov
Date: Mon Aug 13 04:57:19 2012
New Revision: 161749

URL: http://llvm.org/viewvc/llvm-project?rev=161749&view=rev
Log:
[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

Modified:
    compiler-rt/trunk/lib/asan/asan_report.cc

Modified: compiler-rt/trunk/lib/asan/asan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_report.cc?rev=161749&r1=161748&r2=161749&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_report.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_report.cc Mon Aug 13 04:57:19 2012
@@ -213,11 +213,11 @@
       // 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");





More information about the llvm-commits mailing list