[PATCH] D58358: [LSan] Fix `__sanitizer_print_stack_trace` via fast unwinder

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 18 13:41:17 PST 2019


yln created this revision.
Herald added subscribers: llvm-commits, Sanitizers, jdoerfert, kubamracek.
Herald added projects: Sanitizers, LLVM.

Quick follow-up to: https://reviews.llvm.org/D58156


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D58358

Files:
  compiler-rt/lib/lsan/lsan.h
  compiler-rt/test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc
  compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc
  compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc


Index: compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc
===================================================================
--- compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc
+++ compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc
@@ -2,7 +2,7 @@
 
 // Test that symbolizer does not crash on frame with large function name.
 
-// FIXME(dliew): Make this test work on Darwin with LSan
+// On Darwin LSan reports a false positive
 // XFAIL: darwin && lsan
 
 #include <sanitizer/common_interface_defs.h>
Index: compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc
===================================================================
--- compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc
+++ compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc
@@ -11,7 +11,7 @@
 // XFAIL: netbsd && !asan
 
 // FIXME(dliew): Make this test work with other sanitizers
-// XFAIL: darwin && (lsan || tsan || ubsan)
+// XFAIL: darwin && (tsan || ubsan)
 
 volatile int *null = 0;
 
Index: compiler-rt/test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc
===================================================================
--- compiler-rt/test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc
+++ compiler-rt/test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc
@@ -1,9 +1,6 @@
 // RUN: %clangxx -O0 %s -o %t && %env_tool_opts=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s
 // RUN: %env_tool_opts=stack_trace_format='"frame:%n lineno:%l"' %run %t 2>&1 | FileCheck %s --check-prefix=CUSTOM
 
-// FIXME(dliew): Make this test work on Darwin with LSan
-// XFAIL: darwin && lsan
-
 #include <sanitizer/common_interface_defs.h>
 
 static inline void FooBarBaz() {
Index: compiler-rt/lib/lsan/lsan.h
===================================================================
--- compiler-rt/lib/lsan/lsan.h
+++ compiler-rt/lib/lsan/lsan.h
@@ -49,7 +49,8 @@
                    __sanitizer::uptr bp, void *context, bool fast) {
   uptr stack_top = 0, stack_bottom = 0;
   ThreadContext *t;
-  if (fast && (t = CurrentThreadContext())) {
+  if (__sanitizer::StackTrace::WillUseFastUnwind(fast) &&
+      (t = CurrentThreadContext())) {
     stack_top = t->stack_end();
     stack_bottom = t->stack_begin();
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58358.187271.patch
Type: text/x-patch
Size: 2318 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190218/c3479bb5/attachment.bin>


More information about the llvm-commits mailing list