This is an archive of the discontinued LLVM Phabricator instance.

[LinkerWrapper] Fix memory issues due to unguarded accesses to global state
ClosedPublic

Authored by jhuber6 on Jan 31 2023, 7:52 AM.

Details

Summary

There were intemittent errors in the linker wrapper when using the
sanitizers in parallel. First, this is because the TempFiles global
was not guarded when creating a new file. Second, even though the Args
list is passed as const, the internal state is mutable when adding a
string. So that needs to be guarded too.

Fixes https://github.com/llvm/llvm-project/issues/60437

Diff Detail

Event Timeline

jhuber6 created this revision.Jan 31 2023, 7:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2023, 7:52 AM
jhuber6 requested review of this revision.Jan 31 2023, 7:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2023, 7:52 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

If this fixes the issues on your side, please open a bug so it can be backported.

@jhuber6
I really have no idea about the fix, but I've run the linker-wrapper.c testcase with asan built binaries with this fix 500 times now without seeing any failures.
Without the fix it fails in like 1 out of 10 runs so it surely looks like the fix does something good!

Nice!

If this fixes the issues on your side, please open a bug so it can be backported.

I wrote
https://github.com/llvm/llvm-project/issues/60437

jhuber6 edited the summary of this revision. (Show Details)Feb 1 2023, 5:04 AM
jhuber6 added a reviewer: tianshilei1992.

Great, I'll land it once the patch is accepted.

uabelho resigned from this revision.Feb 1 2023, 5:50 AM

Great, I'll land it once the patch is accepted.

Thanks! Thumbs up from me, unfortunately I don't feel confident to review the actual code change.

This revision is now accepted and ready to land.Feb 1 2023, 6:09 AM
This revision was landed with ongoing or failed builds.Feb 1 2023, 6:12 AM
This revision was automatically updated to reflect the committed changes.