This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Avoid data race in ObjectFile<ELFT>::getDILineInfo().
ClosedPublic

Authored by ikudrin on Jul 18 2017, 3:06 AM.

Details

Summary

It is possible that this method is called simultaneously from several threads,
so the initialization of DwarfLine has to be protected.

In my case the call sequence was the following:
OutputSectionCommand::writeTo() -> parallelForEachN() ->
(two parallel threads) ->
InputSection::writeTo() -> InputSectionBase::relocate() ->
InputSectionBase::relocateAlloc() -> AArch64::relocateOne() ->
checkInt<28>() -> getErrorLocation() -> getErrorLoc() ->
InputSectionBase::getLocation() -> ObjectFile<ELFT>::getLineInfo() ->
ObjectFile<ELFT>::getDILineInfo() -> ObjectFile<ELFT>::initializeDwarfLine().

Diff Detail

Repository
rL LLVM

Event Timeline

ikudrin created this revision.Jul 18 2017, 3:06 AM
ruiu accepted this revision.Jul 20 2017, 9:26 AM

LGTM

This revision is now accepted and ready to land.Jul 20 2017, 9:26 AM
This revision was automatically updated to reflect the committed changes.