From: Pedro Alves <pedro@palves.net>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH][gdb] Block SIGTERM in worker threads
Date: Thu, 30 Jun 2022 12:08:07 +0100 [thread overview]
Message-ID: <b4c54295-70aa-c446-22d5-46a0927a1c51@palves.net> (raw)
In-Reply-To: <20220630095824.GA24025@delia.home>
On 2022-06-30 10:58, Tom de Vries wrote:
> Hi,
>
> With gdb build with gcc-12 and -fsanitize=thread, and test-case
> gdb.base/gdb-sigterm.exp, I run into:
> ...
> WARNING: ThreadSanitizer: data race (pid=9722)^M
> Write of size 4 at 0x00000325bc68 by thread T1:^M
> #0 handle_sigterm(int) src/gdb/event-top.c:1211 (gdb+0x8ec01f)^M
> ...
> Previous read of size 4 at 0x00000325bc68 by main thread:^M
> [failed to restore the stack]^M
> ^M
> Location is global 'sync_quit_force_run' of size 4 at \
> 0x00000325bc68 (gdb+0x325bc68)^M
> ...
> SUMMARY: ThreadSanitizer: data race gdb/event-top.c:1211 in \
> handle_sigterm(int)^M
> ...
> and 3 more data races involving handle_sigterm and locations:
> - active_ext_lang
> - quit_flag
> - heap block of size 40
> (XNEW (async_signal_handler) in create_async_signal_handler)
>
> This was reported in PR29297.
>
> The testcase executes a "kill -TERM $gdb_pid", which generates a
> process-directed signal.
>
> A process-directed signal can be delivered to any thread, and what we see
> here is the fallout of the signal being delivered to a worker thread rather
> than the main thread.
>
> Fix this by blocking SIGTERM in the worker threads.
>
> [ I have not been able to reproduce this after it occurred for the first time,
> so unfortunately I cannot confirm that the patch fixes the problem. ]
>
> Tested on x86_64-linux, with and without -fsanitize=thread.
>
> Any comments?
OK.
prev parent reply other threads:[~2022-06-30 11:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 9:58 Tom de Vries
2022-06-30 11:08 ` Pedro Alves [this message]
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=b4c54295-70aa-c446-22d5-46a0927a1c51@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).