git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] trace2: intercept all common signals

From
Junio C Hamano <gitster@pobox.com>
Date
May 16, 2024, 16:32 UTC
Message-ID
<xmqqwmntra3f.fsf@gitster.g>
In-Reply-To
<20240516071127.GA83658@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
>   - 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.

Previous: Jeff KingNext: Jeff King
Message 13 of 14 in “trace2: intercept all common signals”
  1. trace2: intercept all common signalsEmily Shaffer, May 10, 2024
  2. Emily ShafferMay 10, 2024
  3. Junio C HamanoMay 10, 2024
  4. Emily ShafferMay 10, 2024
  5. Jeff KingMay 10, 2024
  6. Emily ShafferMay 10, 2024
  7. Jeff KingMay 10, 2024
  8. Junio C HamanoMay 10, 2024
  9. Jeff KingMay 10, 2024
  10. Jeff KingMay 10, 2024
  11. Emily ShafferMay 13, 2024
  12. Jeff KingMay 16, 2024
  13. Junio C HamanoMay 16, 2024
  14. Jeff KingMay 23, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.