[PATCH] gold: Avoid sharing Plugin_list::iterator

Cary Coutant ccoutant@gmail.com
Fri Nov 6 23:01:22 GMT 2020


> > 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.
>
> Thanks for your analysis.  I will check it in next Monday if Cary has no
> comments.

I believe this is wrong. In claim_file(), the code already holds a
lock, so there should be no concurrent access to the iterator. In
all_symbols_read(), the current task (Plugin_hook) should be the only
one running at the time. Plugin_manager::current_ needs to be set so
that when the plugin calls back, we know which plugin is currently
active. This patch breaks that.

Thanks for the analysis, which I'll study in more detail. I'm trying
to figure out what's going on here. There really shouldn't be two
threads both calling all_symbols_read().

-cary


More information about the Binutils mailing list