This is an archive of the discontinued LLVM Phabricator instance.

[asan_symbolize] Teach `asan_symbolize.py` to symbolicate using a module map
ClosedPublic

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

Details

Summary

The use case here is to be able get the UUIDs of the modules that need
to be symbolicated so that external plugins can see them. This
information can be extracted from ASan reports if the print_module_map
ASan option is enabled. Currently printing of the module map is only
implemented on Darwin and so this is effectively a Darwin only feature
right now.

The module map hooks into symbolization using the new plugin
infrastructure. A new hook in AsanSymbolizerPlugInProxy (and in
AsanSymbolizerPlugIn) is also provided to allow external plugins to hook
into the module look up process. This will allow external plugins to
look up modules with knowledge of their UUID.

The new plug-in is currently stored in the asan_symbolize.py script.
We could potentially move this into a separate file in the future (to
reduce clutter) if we can come up with a policy for where to search for
plugins that should always get loaded.

rdar://problem/49476995

Diff Detail

Repository
rL LLVM

Event Timeline

delcypher created this revision.Apr 10 2019, 12:25 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 10 2019, 12:25 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
delcypher updated this revision to Diff 194590.Apr 10 2019, 2:28 PM
  • Use cstdlib header rather than stdlib.h
  • Drop unused assert.h

Is there a reason to tests this on Darwin only?

Is there a reason to tests this on Darwin only?

@vitalybuka
Yes because printing the module map is only implemented on Darwin. The functionality is implemented in PrintModuleMap() and last time I checked this was a no-op on all platforms except Darwin.
If other platforms implement the feature then we can move the test, but right now this isn't the case.

vitalybuka accepted this revision.Apr 24 2019, 1:08 PM

Thanks for explanation

This revision is now accepted and ready to land.Apr 24 2019, 1:08 PM
This revision was automatically updated to reflect the committed changes.

Thanks for explanation

Thanks for the review.

thakis added a subscriber: thakis.Aug 1 2019, 11:13 AM
thakis added inline comments.
compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py
949

It looks like we always unconditionally add this plugin, yet this plugin requires otool. Doesn't this break asan_symbolize.py on non-darwin? If not, why not?

delcypher marked an inline comment as done.Aug 1 2019, 2:20 PM
delcypher added inline comments.
compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py
949

Plug-ins can unload themselves by returning False from their process_cmdline_args(self, pargs) method. In this particular case if --module-map is not provided on the command line then the plug-in will unload itself and will not be used.