[PATCH 0/2] Fix some races seen by thread sanitizer

Tom Tromey tom@tromey.com
Sun Mar 24 21:08:04 GMT 2024


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.

Tom



More information about the Binutils mailing list