[PATCH 0/2] Fix some races seen by thread sanitizer
Nick Clifton
nickc@redhat.com
Fri Apr 12 13:03:35 GMT 2024
Hi Tom,
> PR gdb/31264 points out some reports from thread sanitizer when
> running some gdb tests.
>
> I couldn't reproduce exactly these reports, but I did find that
> bfd_check_format_matches uses some globals without locking, which is
> definitely not thread-safe. These are fixed in patch #1.
>
> And, when working on this, I did manage to get other thread sanitizer
> reports from the same gdb test case -- a problem when
> bfd_check_format_matches is called simultaneously with
> bfd_cache_close_all. This is fixed in patch #2.
>
> For patch #1, the per-xvec error-emission code was written to fix some
> fuzzer bug, but I don't have access to the original test file here, so
> I wasn't really able to test that the reimplementation is correct.
>
> For patch #2, see the note in that commit about the archive case in
> bfd_cache_lookup_worker.
>
> Let me know what you think.
Personally I do not think that any library function should ever call
abort(), but I guess that in this case the coder wanted to be made
aware immediately if the function was ever called with an entirely
artifical bfd (ie one just held in memory with no on-disk version).
Anyway, patch series approved, please apply.
Cheers
Nick
More information about the Binutils
mailing list