This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Pass BP and stack bounds to Unwind() to get full stack traces on failed CHECKs
Needs ReviewPublic

Authored by kubamracek on Dec 16 2016, 3:30 PM.

Details

Reviewers
dvyukov
Summary

At least on Darwin, the fast unwinder called from TsanCheckFailed completely fails to unwind anything, because we don't give it a valid bp, stack_top and stack_bottom. Let's fix that.

Diff Detail

Event Timeline

kubamracek updated this revision to Diff 81805.Dec 16 2016, 3:30 PM
kubamracek retitled this revision from to [tsan] Pass BP and stack bounds to Unwind() to get full stack traces on failed CHECKs.
kubamracek updated this object.
kubamracek added a reviewer: dvyukov.
kubamracek set the repository for this revision to rL LLVM.
kubamracek added a project: Restricted Project.
kubamracek added subscribers: llvm-commits, zaks.anna.
dvyukov added inline comments.Dec 19 2016, 2:14 AM
lib/tsan/rtl/tsan_rtl_report.cc
700

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.