This is an archive of the discontinued LLVM Phabricator instance.

Add missing call to `Symbolizer::LateInitialize()` in UBSan's standalone init.
ClosedPublic

Authored by delcypher on Apr 20 2020, 6:50 PM.

Details

Summary

This fixes symbolization in Standalone UBSan mode for the Darwin simulators.

861b69faee5df8d4e13ef316c7474a10e4069e81 (rdar://problem/58789439) tried to fix
symbolization for all sanitizers on Darwin simulators but unfortunately it only
fixed the problem for TSan.

For UBSan in standalone mode the fix wasn't sufficient because UBSan's
standalone init doesn't call Symbolizer::LateInitialize() like ASan
and TSan do. This meant that AtosSymbolizerProcess::LateInitialize()
was never being called before
AtosSymbolizerProcess::StartSymbolizerSubprocess() which breaks an
invariant we expect to hold.

The missing call to Symbolizer::LateInitialize() during UBSan's
standalone init seems like an accidently omission so this patch simply
adds it.

rdar://problem/62083617

Diff Detail

Event Timeline

delcypher created this revision.Apr 20 2020, 6:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2020, 6:50 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
yln accepted this revision.Apr 21 2020, 9:26 AM
This revision is now accepted and ready to land.Apr 21 2020, 9:26 AM

@vsk @vitalybuka Any thoughts on this?

If I was really being consistent with ASan/TSan init I would also add a call to Symbolizer::GetOrInit() before Symbolizer::LateInitialize() but it's technically not necessary because all Symbolizer::LateInitialize() implementations call it anyway. To keep the patch simple I didn't add it but should I for consistency?

vsk accepted this revision.Apr 21 2020, 12:08 PM

Thanks!

Adding the extra 'GetOrInit' doesn't sound great to me, it seems like an implementation detail that ought to be guaranteed by LateInitialize.

And I don’t think we should try to not call LateInitialize when it’s not needed. If there’s runtime code that depends on symbolication being present, that’s ok, it shouldn’t have to check for the symbolicator being initialized first.

This revision was automatically updated to reflect the committed changes.