[PATCH] gold: ensure file_counts_lock is initialized before using
Cary Coutant
ccoutant@gmail.com
Mon Nov 2 18:09:43 GMT 2020
On Tue, Oct 20, 2020 at 2:29 AM Nick Gasson via Binutils
<binutils@sourceware.org> wrote:
>
> Since upgrading to binutils 2.35 I've been experiencing random memory
> corruption related crashes with ld.gold --threads. It's caused by
> multiple threads concurrently pushing elements onto the shared
> std::vector in File_read::record_file_read(). This vector is supposed to
> be protected by file_counts_lock, but that is initialized lazily and
> might be NULL when File_read::open() is called, in which case
> Hold_optional_lock silently skips locking it.
>
> Fix by calling the initialize() method before attempting to acquire the
> lock, the same as other places that use file_counts_lock.
>
> * fileread.cc (File_read::open): Ensure file_counts_lock is
> initialized.
This patch is OK. Please update the ChangeLog entry with the PR
number. Can you apply or do you need me to do it?
Thanks!
-cary
More information about the Binutils
mailing list