diff options
author | Tom Tromey <tom@tromey.com> | 2024-11-01 17:19:20 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-12-12 13:13:04 -0700 |
commit | e1093de6a0feeb44a6a2f3bb4509d35eb28bcb66 (patch) | |
tree | f46a2d7fd4516a6bf8965b56aa338dc393aac24c /gdb/objfiles.c | |
parent | cf11692c90b93a23f5c22b78a116287664e36a04 (diff) | |
download | binutils-e1093de6a0feeb44a6a2f3bb4509d35eb28bcb66.zip binutils-e1093de6a0feeb44a6a2f3bb4509d35eb28bcb66.tar.gz binutils-e1093de6a0feeb44a6a2f3bb4509d35eb28bcb66.tar.bz2 |
Fix races involving _bfd_section_id
BFD's threading approach is that global variables are guarded by a
lock. However, while implementing this, I missed _bfd_section_id. A
user pointed out, via Thread Sanitizier, that this causes a data race
when gdb's background DWARF reader is enabled.
This patch fixes the problem by using the BFD lock in most of the
appropriate spots. However, in ppc64_elf_setup_section_lists I chose
to simply assert that multiple threads are not in use instead. (Not
totally sure if this is good, but I don't think this can be called by
gdb.)
I chose locking in bfd_check_format_matches, even though it is a
relatively big hammer, because it seemed like the most principled
approach, and anyway if this causes severe contention we can always
revisit the decision. Also this approach means we don't need to add
configury to check for _Atomic, or figure out whether bfd_section_init
can be reworded to make "rollback" unnecessary.
I couldn't reproduce these data races but the original reporter tested
the patch and confirms that it helps.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31713
Diffstat (limited to 'gdb/objfiles.c')
0 files changed, 0 insertions, 0 deletions