[RFC][PATCH] fix Read_symbols datarace

Cary Coutant ccoutant@google.com
Wed Nov 5 22:53:00 GMT 2014


> After update to gcc 4.9.2, link of my project failed,
> because of ld.gold crash.
> I reproduce this problem:
> https://sourceware.org/bugzilla/show_bug.cgi?id=17538
>
> Today I dig into this, and see that problem in
> that multiply threads run
> Read_symbols::do_read_symbols
> which call
> Plugin_manager::claim_file
> which call
> this->objects_.push_back
>
> without any sync, and so std::vector was modified
> in many threads without any locks, which of course
> cause crashes.
>
> Attached patch fix problem for me.
> Comments?

Thanks for finding this! A couple of minor comments, but it looks good...

Please write a ChangeLog entry.

+      this_blocker_(NULL), extra_search_path_(), lock_(NULL),
initialize_lock_(&lock_)

Line too long; please wrap.

+  Lock *lock_;

For C++ code, the "*" goes with the type: "Lock* lock_;".

Do you have commit access?

-cary



More information about the Binutils mailing list