[compiler-rt] r176555 - [msan] Block reports from interceptors during _Unwind_Backtrace

Reid Kleckner reid at kleckner.net
Wed Mar 6 08:11:59 PST 2013


Author: rnk
Date: Wed Mar  6 10:11:58 2013
New Revision: 176555

URL: http://llvm.org/viewvc/llvm-project?rev=176555&view=rev
Log:
[msan] Block reports from interceptors during _Unwind_Backtrace

Summary:
I'm hitting a big recursive report from:
  uninit on strlen ->
  __msan::PrintWarningWithOrigin() ->
  __msan::GetStackTrace() ->
  __sanitizer::StackTrace::SlowUnwindStack() ->
  _Unwind_Backtrace() ->
  ... libgcc calls ->
  uninit on strlen() ->
  ... repeats

Reviewers: eugenis

Differential Revision: http://llvm-reviews.chandlerc.com/D497

Modified:
    compiler-rt/trunk/lib/msan/msan.cc
    compiler-rt/trunk/lib/msan/msan.h
    compiler-rt/trunk/lib/msan/msan_report.cc

Modified: compiler-rt/trunk/lib/msan/msan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.cc?rev=176555&r1=176554&r2=176555&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.cc (original)
+++ compiler-rt/trunk/lib/msan/msan.cc Wed Mar  6 10:11:58 2013
@@ -153,8 +153,11 @@ static void GetCurrentStackBounds(uptr *
 
 void GetStackTrace(StackTrace *stack, uptr max_s, uptr pc, uptr bp,
                    bool fast) {
-  if (!fast)
+  if (!fast) {
+    // Block reports from our interceptors during _Unwind_Backtrace.
+    SymbolizerScope sym_scope;
     return stack->SlowUnwindStack(pc, max_s);
+  }
 
   uptr stack_top, stack_bottom;
   GetCurrentStackBounds(&stack_top, &stack_bottom);

Modified: compiler-rt/trunk/lib/msan/msan.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.h?rev=176555&r1=176554&r2=176555&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.h (original)
+++ compiler-rt/trunk/lib/msan/msan.h Wed Mar  6 10:11:58 2013
@@ -50,6 +50,11 @@ void EnterSymbolizer();
 void ExitSymbolizer();
 bool IsInSymbolizer();
 
+struct SymbolizerScope {
+  SymbolizerScope() { EnterSymbolizer(); }
+  ~SymbolizerScope() { ExitSymbolizer(); }
+};
+
 void MsanDie();
 void PrintWarning(uptr pc, uptr bp);
 void PrintWarningWithOrigin(uptr pc, uptr bp, u32 origin);

Modified: compiler-rt/trunk/lib/msan/msan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_report.cc?rev=176555&r1=176554&r2=176555&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_report.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_report.cc Wed Mar  6 10:11:58 2013
@@ -44,11 +44,6 @@ class Decorator: private __sanitizer::An
   const char *End()    { return Default(); }
 };
 
-struct SymbolizerScope {
-  SymbolizerScope() { EnterSymbolizer(); }
-  ~SymbolizerScope() { ExitSymbolizer(); }
-};
-
 static void PrintStack(const uptr *trace, uptr size) {
   SymbolizerScope sym_scope;
   StackTrace::PrintStack(trace, size, true, flags()->strip_path_prefix, 0);





More information about the llvm-commits mailing list