aboutsummaryrefslogtreecommitdiff
path: root/libctf
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2024-03-23 15:19:20 -0600
committerTom Tromey <tom@tromey.com>2024-04-16 14:02:15 -0600
commit20bf7711bce2188c1af985a87df23c4653c2cc7a (patch)
tree1694e1225dc42af7cd6b46d07e6323bd7bcd4a33 /libctf
parentbacc61fd3e6fd61a59fb59bcc657be17a381520d (diff)
downloadgdb-20bf7711bce2188c1af985a87df23c4653c2cc7a.zip
gdb-20bf7711bce2188c1af985a87df23c4653c2cc7a.tar.gz
gdb-20bf7711bce2188c1af985a87df23c4653c2cc7a.tar.bz2
Avoid cache race in bfd_check_format_matches
Running the gdb test suite with the thread sanitizer enabled shows a race when bfd_check_format_matches and bfd_cache_close_all are called simultaneously on different threads. This patch fixes this race by having bfd_check_format_matches temporarily remove the BFD from the file descriptor cache -- leaving it open while format-checking proceeds. In this setup, the BFD client is responsible for closing the BFD again on the "checking" thread, should that be desired. gdb does this by calling bfd_cache_close in the relevant worker thread. An earlier version of this patch omitted the "possibly_cached" helper function. However, this ran into crashes in the binutils test suite involving the archive-checking abort in bfd_cache_lookup_worker. I do not understand the purpose of this check, so I've simply had the new function work around it. I couldn't find any comments explaining this situation, either. I suspect that there may still be races related to this case, but I don't think I have access to the platforms where gdb deals with archives. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31264
Diffstat (limited to 'libctf')
0 files changed, 0 insertions, 0 deletions