From: Takashi Iwai <tiwai@suse.de>
To: Jeff King <peff@peff.net>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org
Subject: Re: glibc mutex deadlock in signal handler
Date: Fri, 04 Sep 2015 15:40:58 +0200 [thread overview]
Message-ID: <s5htwrai9p1.wl-tiwai@suse.de> (raw)
In-Reply-To: <20150904130448.GB25501@sigill.intra.peff.net>
On Fri, 04 Sep 2015 15:04:48 +0200,
Jeff King wrote:
>
> On Fri, Sep 04, 2015 at 11:35:57AM +0200, Takashi Iwai wrote:
>
> > > Hmm, is there is any reason to just pass an "in_signal" flag to
> > > wait_for_pager(), to avoid duplicating the logic?
> >
> > Just because wait_for_pager() itself is an atexit hook that can't take
> > an argument, so we'd need to split to a new function. I don't mind
> > either way. The revised patch is below.
>
> Ah, right. That's unfortunate, but I think I prefer adding the extra
> wrapper to duplicating the contents of the function.
>
> > -- 8< --
> > From: Takashi Iwai <tiwai@suse.de>
> > Subject: [PATCH v2] pager: don't use unsafe functions in signal handlers
> > [...]
>
> This looks good to me. Do you plan on fixing any of the other handlers
> (you don't have to; I just want to know if somebody is planning to work
> on it).
Heh, I'd like to leave the rest for professionals :)
> The pattern of atexit and signal handlers is repeated in several places,
> and it seems like we will have to add the same in_signal boilerplate in
> each instance. I wonder if we should provide a global "register_cleanup"
> that takes a "void (*func)(int in_signal))" function pointer, and:
>
> 1. Adds it to a list (ideally in a way that is atomic if we get
> interrupted while adding to the list).
>
> 2. If not already run, registers an atexit() handler and
> sigchain_push_common for a meta-handler which runs through the list
> and runs each handler.
>
> It's not a _huge_ amount of boilerplate code we'd be saving, but at
> least conforming to the "in_signal" function template would make people
> think twice about what they're doing inside the cleanup function. :)
Or, we may have a global in_signal flag. Of course, this is bad if
git itself is multi-threaded, though.
thanks,
Takashi
next prev parent reply other threads:[~2015-09-04 13:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-03 11:00 glibc mutex deadlock in signal handler Takashi Iwai
2015-09-03 18:12 ` Junio C Hamano
2015-09-03 19:34 ` Takashi Iwai
2015-09-03 20:55 ` Andreas Schwab
2015-09-04 5:52 ` Takashi Iwai
2015-09-04 9:23 ` Jeff King
2015-09-04 9:35 ` Takashi Iwai
2015-09-04 13:04 ` Jeff King
2015-09-04 13:40 ` Takashi Iwai [this message]
2015-09-04 21:56 ` Junio C Hamano
2015-09-05 8:59 ` Jeff King
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=s5htwrai9p1.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=schwab@linux-m68k.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: 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 NNTP newsgroup(s).