[PATCH] D19148: Always inlining PrintCurrentStackSlow of tsan library to fix tail-call issue

Chuang-Yu Cheng via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 22:04:27 PDT 2016


cycheng created this revision.
cycheng added reviewers: samsonov, hfinkel, kbarton, tjablin.
cycheng added a subscriber: llvm-commits.

LocatePcInTrace requires __sanitizer_print_stack_trace exists in the actual
unwinded stack, so it can find a pc that satisfy the threshold. Because
  pc of __sanitizer_print_stack_trace in the actual unwinded stack, and
  pc of GetCurrentPc
should be slightly difference.

But tail-call to PrintCurrentStackSlow breaks this requirement because
 __sanitizer_print_stack_trace disappears after tail-call. See PR27280 comment
1~3 for examples.


http://reviews.llvm.org/D19148

Files:
  lib/tsan/rtl/tsan_rtl_report.cc

Index: lib/tsan/rtl/tsan_rtl_report.cc
===================================================================
--- lib/tsan/rtl/tsan_rtl_report.cc
+++ lib/tsan/rtl/tsan_rtl_report.cc
@@ -25,6 +25,7 @@
 #include "tsan_mman.h"
 #include "tsan_flags.h"
 #include "tsan_fd.h"
+#include "llvm/Support/Compiler.h"
 
 namespace __tsan {
 
@@ -680,6 +681,12 @@
   PrintStack(SymbolizeStack(trace));
 }
 
+// Always inlining PrintCurrentStackSlow, because LocatePcInTrace assumes
+// __sanitizer_print_stack_trace exists in the actual unwinded stack, but
+// tail-call to PrintCurrentStackSlow breaks this assumption because
+// __sanitizer_print_stack_trace disappears after tail-call.
+// See PR27280 comment 1~3 for examples.
+LLVM_ATTRIBUTE_ALWAYS_INLINE
 void PrintCurrentStackSlow(uptr pc) {
 #ifndef SANITIZER_GO
   BufferedStackTrace *ptrace =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19148.53842.patch
Type: text/x-patch
Size: 839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160415/829baf4e/attachment.bin>


More information about the llvm-commits mailing list