public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/31264] [gdb] ThreadSanitizer: data race format.c:132 in bfd_preserve_save Date: Tue, 16 Apr 2024 22:53:46 +0000 [thread overview] Message-ID: <bug-31264-4717-8IgvAWk7Nu@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-31264-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=31264 --- Comment #12 from Sourceware Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tom Tromey <tromey@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bacc61fd3e6fd61a59fb59bcc657be17a381520d commit bacc61fd3e6fd61a59fb59bcc657be17a381520d Author: Tom Tromey <tom@tromey.com> Date: Mon Feb 12 18:06:56 2024 -0700 Thread-safety improvements for bfd_check_format_matches A gdb bug found that bfd_check_format_matches has some data races when called from multiple threads. In particular, it changes the BFD error handler, which is a global. It also has a local static variable ("in_check_format") that is used for recursion detection. And, finally, it may emit warnings to the per-xvec warning array, which is a global. This patch removes all the races here. The first part of patch is to change _bfd_error_handler to directly handle the needs of bfd_check_format_matches. This way, the error handler does not need to be changed. This change lets us use the new per-thread global (error_handler_messages, replacing error_handler_bfd) to also remove the need for in_check_format -- a single variable suffices. Finally, the global per-xvec array is replaced with a new type that holds the error messages. The outermost such type is stack-allocated in bfd_check_format_matches. I tested this using the binutils test suite. I also built gdb with thread sanitizer and ran the test case that was noted as failing. Finally, Alan sent me the test file that caused the addition of the xvec warning code in the first place, and I confirmed that "nm-new" has the same behavior on this file both before and after this patch. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31264 Co-Authored-By: Alan Modra <amodra@gmail.com> -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2024-04-16 22:53 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-18 9:49 [Bug gdb/31264] New: " vries at gcc dot gnu.org 2024-01-22 18:49 ` [Bug gdb/31264] " vries at gcc dot gnu.org 2024-01-22 20:32 ` tromey at sourceware dot org 2024-01-23 1:10 ` tromey at sourceware dot org 2024-01-23 8:58 ` vries at gcc dot gnu.org 2024-01-23 9:38 ` vries at gcc dot gnu.org 2024-01-29 20:14 ` tromey at sourceware dot org 2024-01-29 20:15 ` tromey at sourceware dot org 2024-01-30 1:35 ` tromey at sourceware dot org 2024-02-12 19:06 ` tromey at sourceware dot org 2024-03-15 0:01 ` tromey at sourceware dot org 2024-03-24 21:13 ` tromey at sourceware dot org 2024-04-14 17:53 ` brobecker at gnat dot com 2024-04-15 12:54 ` tromey at sourceware dot org 2024-04-16 22:53 ` cvs-commit at gcc dot gnu.org [this message] 2024-04-16 22:53 ` cvs-commit at gcc dot gnu.org 2024-04-16 22:55 ` tromey at sourceware dot org 2024-05-17 14:17 ` tromey at sourceware dot org
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=bug-31264-4717-8IgvAWk7Nu@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).