]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Lock bfd_stat and bfd_get_mtime
authorTom Tromey <tom@tromey.com>
Sat, 9 Nov 2024 20:45:50 +0000 (13:45 -0700)
committerTom Tromey <tom@tromey.com>
Thu, 12 Dec 2024 22:17:39 +0000 (15:17 -0700)
commita357defdfe2af758d5ec9f0040949bf1db4cbe53
tree083ad517656fad650c0c582fe09ea7f589187bec
parente1093de6a0feeb44a6a2f3bb4509d35eb28bcb66
Lock bfd_stat and bfd_get_mtime

PR gdb/31713 points out some races when using the background DWARF
reader.

This particular patch fixes some of these, namely the ones when using
the sim.  In this case, the 'load' command calls reopen_exec_file,
which calls bfd_stat, which introduces a race.

BFD only locks globals -- concurrent use of a single BFD must be
handled by the application.  To this end, this patch adds locked
wrappers for bfd_stat and bfd_get_mtime.

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
Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/corefile.c
gdb/exec.c
gdb/gdb_bfd.c
gdb/gdb_bfd.h
gdb/machoread.c
gdb/objfiles.c
gdb/symfile.c