[PATCH] gold: Avoid sharing Plugin_list::iterator

Alan Modra amodra@gmail.com
Fri Nov 6 21:56:49 GMT 2020


On Fri, Nov 06, 2020 at 01:05:56PM +1030, Alan Modra wrote:
> On Thu, Nov 05, 2020 at 05:46:46PM -0800, H.J. Lu wrote:
> > On Thu, Nov 5, 2020 at 4:42 PM Alan Modra <amodra@gmail.com> wrote:
> > > HJ, I don't need to be told why sharing variables among threads can go
> > > wrong.  I understand that quite well.  I was asking for the specifics
> > > of what was going wrong.  Now if you haven't analysed the problem to
> > > that level, that's fine, just say so.
> > 
> > I didn't know what went wrong.
> 
> OK, I just tried clang --sanitize=thread and see the following.  It
> looks like Plugin_manager::claim_file and
> Plugin_manager::all_symbols_read might be running simultaneously.
> This was with commit 712b8a0f68f binutils source.
> 
> That in itself is interesting, and says to me that
> Plugin_manager::all_symbols_read is running too soon.

No, I jumped to the wrong conclusion.  A little more analysis reveals
that the object triggering Plugin_manager::claim_file in ths case is
the LTO output, not one of the command line input objects.  I have no
further worries about plugin data races, and in my opinion HJ's patch
is the correct fix.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list