From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 2/2] [gdb/symtab] Fix data race in try_open_dwop_file
Date: Wed, 27 May 2026 21:16:16 +0200 [thread overview]
Message-ID: <e683de85-64bf-4da6-bd90-85f89bd540fa@suse.de> (raw)
In-Reply-To: <877brrnxrw.fsf@tromey.com>
On 3/4/26 9:29 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>
> Tom> The call to bfd_check_format in try_open_dwop_file:
> Tom> ...
> Tom> /* The operations below are not thread-safe, use a lock to synchronize
> Tom> concurrent accesses. */
> Tom> static gdb::mutex mutex;
> Tom> gdb::lock_guard<gdb::mutex> lock (mutex);
>
> Tom> if (!bfd_check_format (sym_bfd.get (), bfd_object))
> Tom> return NULL;
> Tom> ...
> Tom> accesses the sym_bfd.get () BFD, so it should be guarded by the global BFD
> Tom> lock.
>
> Doesn't bfd_check_format do this itself?
Hi Tom,
thanks for the review, and sorry for the delay in replying, I seem to
have dropped the ball on this.
AFAIU, bfd_check_format does locking, but it's only used to [1]:
...
lock the internal global data structures of BFD (like its global cache
or some global counter), but not data in individual `bfd *`instances. ...
So while it does do locking, it's not sufficient.
> Otherwise, don't we need to wrap all calls to bfd_check_format?
>
Agreed, and likewise for bfd_check_format_matches.
I've submitted a v3 that adds this (
https://sourceware.org/pipermail/gdb-patches/2026-May/227652.html ).
Thanks,
- Tom
> Tom> The local lock also guarded a call to gdb_bfd_record_inclusion, which doesn't
> Tom> do any locking, so likewise use the global BFD lock in
> Tom> gdb_bfd_record_inclusion.
>
> This part seems unobjectionable to me.
>
> Tom
[1] https://sourceware.org/pipermail/gdb-patches/2026-January/224291.html
next prev parent reply other threads:[~2026-05-27 19:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 18:09 [PATCH v2 0/2] [gdb] TSAN fixes Tom de Vries
2026-02-16 18:09 ` [PATCH v2 1/2] [gdb/symtab] Replace per-BFD lock with global BFD lock Tom de Vries
2026-03-04 20:20 ` Tom Tromey
2026-03-05 21:13 ` Tom de Vries
2026-02-16 18:09 ` [PATCH v2 2/2] [gdb/symtab] Fix data race in try_open_dwop_file Tom de Vries
2026-03-04 20:29 ` Tom Tromey
2026-05-27 19:16 ` Tom de Vries [this message]
2026-05-27 20:48 ` Tom Tromey
2026-05-27 21:55 ` Tom de Vries
2026-03-03 15:34 ` [PING][PATCH v2 0/2] [gdb] TSAN fixes Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e683de85-64bf-4da6-bd90-85f89bd540fa@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox