This is an archive of the discontinued LLVM Phabricator instance.

[NFC][Sanitizer] Add new BufferedStackTrace::Unwind API
ClosedPublic

Authored by yln on Feb 27 2019, 2:58 PM.

Details

Summary

Add new Unwind API. This is the final envisioned API with the correct
abstraction level. It hides/slow fast unwinder selection from the caller
and doesn't take any arguments that would leak that abstraction (i.e.,
arguments like stack_top/stack_bottom).

GetStackTrace will become an implementation detail (private method) of
the BufferedStackTrace class.

Let's postpone cleaning up the individual GetStackTrace implementations
until the surrounding code is in its final state.

Event Timeline

yln created this revision.Feb 27 2019, 2:58 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
Herald added subscribers: llvm-commits, Restricted Project, kubamracek. · View Herald Transcript
yln removed a reviewer: jfb.Feb 27 2019, 3:00 PM
yln removed a reviewer: jfb.Feb 27 2019, 3:00 PM
vitalybuka added inline comments.Feb 28 2019, 5:18 PM
compiler-rt/lib/msan/msan.h
342

do you need fast = false; here?

352

Can you add BufferedStackTrace::UnwindOnFatal and read fast_unwind_on_fatal there?
if possible in followup patch

compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h
23

can you make it as private BufferedStackTrace::UnwindImpl
as follow up patch

compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cc
104

please inline fast_unwind_on_fatal

compiler-rt/lib/tsan/rtl/tsan_rtl.cc
331

please inline fast_unwind_on_fatal

compiler-rt/lib/ubsan/ubsan_diag_standalone.cc
34

it's better and consistent as

stack.Unwind(pc, bp, nullptr, common_flags()->fast_unwind_on_fatal);
compiler-rt/lib/ubsan/ubsan_signals_standalone.cc
45

maybe stack.UnwindOnSingnal(sig) in a separate patch?

vitalybuka accepted this revision.Feb 28 2019, 5:29 PM

LGTM, as the only critical comment is msan.h:342
don't ignore the rest, please :)

This revision is now accepted and ready to land.Feb 28 2019, 5:29 PM
yln marked 9 inline comments as done.Feb 28 2019, 6:20 PM
yln added inline comments.
compiler-rt/lib/msan/msan.h
342

Good catch, again! The way it is now is not strictly NFC.
I will remove the second part of the or and inline fast.

352

Ideally we would have Unwind** methods so that we didn't even need an overload with the request_fast parameter (which is confusing and easy to misuse). That's another big refactoring however...

yln marked 2 inline comments as done.Feb 28 2019, 6:20 PM
This revision was automatically updated to reflect the committed changes.