Git development
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>,
	phillip.wood@dunelm.org.uk
Cc: ian4hu <hu2008yinxiang@163.com>,
	git@vger.kernel.org, gitster@pobox.com, peff@peff.net
Subject: Re: [PATCH] sigchain: recover from concurrent double-pops of the same signal
Date: Sat, 31 Oct 2026 14:50:36 +0000	[thread overview]
Message-ID: <97b9f962-78c4-43cf-9782-4d479b57f103@gmail.com> (raw)
In-Reply-To: <auRZNlHezwALJOD5@ugly.lan>

On 30/10/2026 08:45, Oswald Buddenhagen wrote:
> On Thu, Oct 29, 2026 at 04:03:18PM +0000, Phillip Wood wrote:
>> On 29/10/2026 14:15, ian4hu wrote:
>>> I left SIGPIPE out precisely to keep the "upstream of a pipe
>>> dies of SIGPIPE" behaviour that common-init.c restores.  The set I
>>> plan to block is SIGINT, SIGHUP, SIGTERM and SIGQUIT.  If you
>>> think SIGPIPE belongs in it too, I will add it.
>>
>> I think we want to block all signals when we create a thread, so that 
>> all signals are handled by the main (initial) thread.
>>
> that wording again does not address the fact that sigpipe is different 
> due to being thread-directed [1]. even if the outcome is identical, it 
> needs to be reasoned about separately.

Oh, thanks for pointing that out, I hadn't realized some signals were 
directed at a specific thread rather than the process. According to my 
copy of The Linux Programming interface SIGBUS, SIGFPE, SIGILL and 
SIGSEGV are all thread-directed as well so, to ensure the process is 
killed if we receive one of those signals, we shouldn't be blocking any 
of those either. sigchain_push_common() installs a handler for SIGPIPE 
so, in principle, we could end up unwinding the chain in two threads, 
I'm not sure if that is likely in practice. If that is an issue, maybe 
we could set a flag in the signal handler to indicate it has already run 
(though I'm not sure it is possible to do that race-free without 
something like atomic_flag_test_and_set()).

Thanks

Phillip

> [1] https://stackoverflow.com/questions/21718311/when-multi-thread- 
> program-receive-a-sigpipe-signal-because-send-which-thread-wo


  reply	other threads:[~2026-10-31 14:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 14:15 [PATCH] sigchain: recover from concurrent double-pops of the same signal ian4hu
2026-10-29 16:03 ` Phillip Wood
2026-10-30  8:45   ` Oswald Buddenhagen
2026-10-31 14:50     ` Phillip Wood [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-10-29 14:13 ian4hu
2026-10-16 12:37 Ian Hu via GitGitGadget
2026-10-28 13:37 ` ian4hu
2026-10-28 14:29   ` Phillip Wood
2026-10-28 14:47     ` ian4hu
2026-10-28 16:39       ` Phillip Wood
2026-10-29 11:15         ` Phillip Wood

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=97b9f962-78c4-43cf-9782-4d479b57f103@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hu2008yinxiang@163.com \
    --cc=oswald.buddenhagen@gmx.de \
    --cc=peff@peff.net \
    --cc=phillip.wood@dunelm.org.uk \
    /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