This is an archive of the discontinued LLVM Phabricator instance.

[asan_symbolize] Teach `asan_symbolize.py` to symbolicate partially symbolicated ASan reports.
ClosedPublic

Authored by delcypher on Apr 10 2019, 12:27 PM.

Details

Summary

The use case here is to be able symbolicate ASan reports that might be
partially symbolicated, in particular where the function name is known but no source
location is available. This can be caused by missing debug info. Previously we
would only try to symbolicate completely unsymbolicated reports.

The code currently contains an unfortunate quirk to handle a darwin
specific bug (rdar://problem/49784442) in the way partially symbolicated
reports are emitted when the source location is missing.

rdar://problem/49476995

Diff Detail

Repository
rL LLVM

Event Timeline

delcypher created this revision.Apr 10 2019, 12:27 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 10 2019, 12:27 PM
Herald added subscribers: Restricted Project, aprantl. · View Herald Transcript
Eugene.Zelenko added inline comments.
test/asan/TestCases/Darwin/asan-symbolize-partial-report-with-module-map.cc
30 ↗(On Diff #194570)

Asserts are not used.

31 ↗(On Diff #194570)

Please use cstdlib for C++ code.

delcypher updated this revision to Diff 194610.Apr 10 2019, 4:22 PM
  • Use cstdlib include instead of stdlib.h
  • Remove unused assert.h include
delcypher marked 2 inline comments as done.Apr 10 2019, 4:23 PM

LGTM

Thanks. I need to land the other patches in the stack first though. This is because asan_symbolize.py needs to use the module map to symbolize on darwin when the atos symbolizer is used (the default).

vitalybuka accepted this revision.Apr 24 2019, 11:05 AM
This revision is now accepted and ready to land.Apr 24 2019, 11:05 AM
vitalybuka requested changes to this revision.Apr 24 2019, 11:07 AM

Can you make the tests Posix?

This revision now requires changes to proceed.Apr 24 2019, 11:07 AM

Can you make the tests Posix?

To clarify, do you mean

  1. Split the test up into the Posix and Darwin specific part (use Module map)
  2. Disable the Posix test for Darwin (it won't work until we fix a bug in the Symbolizer implementation for Darwin).

If, yes then this seems like a good idea.

vitalybuka accepted this revision.Apr 26 2019, 10:45 AM

Thanks, You already explained that module-map is Darwin specific on another patch.
You are still welcome to extract Posix stuff if you see how.

This revision is now accepted and ready to land.Apr 26 2019, 10:45 AM

@vitalybuka Sorry I forgot about this. I tried to make the test to work in a POSIX use case and I can't make it work. The problem is that when I use %M with stack_trace_format the module name gets stripped (i.e. an absolute path to the binary just becomes the file name of the binary) due to the call to StripModuleName(). This results in us not being able to symbolicate the report from the python script because we don't have the absolute path to the binaries we need to access to perform symbolication.

I have no idea why for %M we strip the module name but when %L is in fallback mode, we don't. This seems oddly inconsistent.

Anyway. Given that I can't make the posix version of the test right now I'll land this as it is.

This revision was automatically updated to reflect the committed changes.
vitalybuka added inline comments.Jul 26 2021, 11:37 PM
compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py
469

why do we need isabs here? should this be os.path.isfile ?