This is an archive of the discontinued LLVM Phabricator instance.

Fix MSAN failure on Function destruction
ClosedPublic

Authored by amaiorano on Feb 6 2020, 1:32 PM.

Details

Summary

When Function is destroyed, GlobalValue base class is destroyed, then
Value destructor would call use_empty, which ultimately attempts to
downcast 'this' to GlobalValue. This is UB, and is caught my MSAN as
accessing uninitialized memory.

Call materialized_use_empty, which doesn't call
assertModuleIsMaterializedImpl().

Diff Detail

Event Timeline

amaiorano created this revision.Feb 6 2020, 1:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 6 2020, 1:32 PM

Please explain in a code comment why use_empty can not be used here.

amaiorano updated this revision to Diff 243017.Feb 6 2020, 2:53 PM
eugenis accepted this revision.Feb 6 2020, 2:54 PM

LGTM

This revision is now accepted and ready to land.Feb 6 2020, 2:54 PM
This revision was automatically updated to reflect the committed changes.