Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <>
To: Jeff King <>
Cc: Emily Shaffer <>,,
Subject: Re: [PATCH] trace2: intercept all common signals
Date: Thu, 16 May 2024 09:32:36 -0700	[thread overview]
Message-ID: <xmqqwmntra3f.fsf@gitster.g> (raw)
In-Reply-To: <> (Jeff King's message of "Thu, 16 May 2024 03:11:27 -0400")

Jeff King <> writes:

>   - the opposite approach might be: stop using any allocating functions
>     in the trace2 code. There's a certain simplicity there, even for
>     non-signal functions, that we know we're just touching a few
>     fixed-size buffers, and you can never create a weird DoS by tweaking
>     the tracing code. But it would mean rewriting a lot of it (including
>     json formatting stuff) without many of our usual strbuf niceties.
>     This is more or less the approach we take with error(), die(), etc,
>     which are built on vreportf() and its fixed buffer.

Would another approach be to add various trace2 functions that use
strbuf() allocation a way to tell if they are called from a signal
handing codepath, and punt (by doing nothing if needed, but
hopefully we have enough slop in the buffer to say "hey we got
interrupted so no more detailed report for you, sorry") if that is
the case?

> So overall it is a pretty thorny problem, and for the most part we've
> just tried to keep what we do inside signal handlers to a minimum
> (usually cleanup, but even there we have to be careful not to do things
> like build up allocated paths for recursive removal).

Yes, I agree that it is the right approach to do very little in a
signal handler.

  reply	other threads:[~2024-05-16 16:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 17:22 [PATCH] trace2: intercept all common signals Emily Shaffer
2024-05-10 17:57 ` Emily Shaffer
2024-05-10 18:47 ` Junio C Hamano
2024-05-10 19:34   ` Emily Shaffer
2024-05-10 19:46     ` Jeff King
2024-05-10 19:49       ` Emily Shaffer
2024-05-10 20:05         ` Jeff King
2024-05-10 20:34     ` Junio C Hamano
2024-05-10 22:20       ` Jeff King
2024-05-10 19:41 ` Jeff King
2024-05-13 16:21   ` Emily Shaffer
2024-05-16  7:11     ` Jeff King
2024-05-16 16:32       ` Junio C Hamano [this message]
2024-05-23  9:36         ` 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqwmntra3f.fsf@gitster.g \ \ \ \ \ \

* 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).