[PATCH] D27866: [tsan] Pass BP and stack bounds to Unwind() to get full stack traces on failed CHECKs

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 02:14:45 PST 2016


dvyukov added inline comments.


================
Comment at: lib/tsan/rtl/tsan_rtl_report.cc:700
           BufferedStackTrace();
-  ptrace->Unwind(kStackTraceMax, pc, 0, 0, 0, 0, false);
+  uptr stack_bottom = cur_thread()->stk_addr;
+  uptr stack_top = stack_bottom + cur_thread()->stk_size;
----------------
This makes me nervous.
CHECK is the lowest tier functionality that should depend on as less things as possible. cur_thread may not be initialized yet, or already destroyed. On both mac and android it contains a bunch of CHECKs (i.e. you get silent crash on stack overflow), on mac mmap in cur_thread can fail (maybe we are CHECK-failed due to OOM), on android cur_thread can return fake dead_thread_state without stack info.
It's better to call GetThreadStackTopAndBottom here.


Repository:
  rL LLVM

https://reviews.llvm.org/D27866





More information about the llvm-commits mailing list