This is an archive of the discontinued LLVM Phabricator instance.

[UBsan] Dumping call stacks when reporting bad-cast (-fsanitize=vptr)
Needs ReviewPublic

Authored by byoungyoung on Jul 7 2014, 10:40 AM.

Details

Summary

When UBsan reports a bad-casting, this patch additional dumps call stacks in the report. To avoid the online symbolization, ubsan_init() is also added to initialize an empty symbolizer.

Diff Detail

Event Timeline

byoungyoung retitled this revision from to [UBsan] Dumping call stacks when reporting bad-cast (-fsanitize=vptr).
byoungyoung updated this object.
byoungyoung edited the test plan for this revision. (Show Details)
byoungyoung updated this object.Jul 7 2014, 10:43 AM
byoungyoung updated this object.
byoungyoung added reviewers: kcc, rsmith, samsonov.
byoungyoung added a subscriber: Unknown Object (MLST).
samsonov edited edge metadata.Jul 15 2014, 9:48 AM

Thanks for working on this. I will take a look at it shortly.

byoungyoung edited edge metadata.

Updated the patch including a test case. The environment variable, UBSAN_NO_SYMBOLIZE, is used to selectively turn off the online symbolization.

Once again, sorry for the delay.

lib/ubsan/ubsan_diag.cc
40

I'm opposed to this. Instead, you should use the value of "symbolize" flag in sanitizer_common. Probably it's time to introduce UBSAN_OPTIONS similar to another sanitizers. I will take a look at existing code and return with more comments.

lib/ubsan/ubsan_diag.h
29

And again, it's better to make use of fast_unwind_on_fatal flag from sanitizer_common.

lib/ubsan/ubsan_handlers_cxx.cc
71

It makes sense to hide this feature under a runtime flag.

samsonov added inline comments.Jul 22 2014, 5:19 PM
lib/ubsan/ubsan_handlers_cxx.cc
38

Required early initialization of UBSan is a separate problem. Let's deal with it later, in subsequent patches.

FYI I'm working on a slightly modified version of this patch. Will update this thread tomorrow.