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

Re: [PATCH 00/10] Advertise trace2 SID in protocol capabilities

From
JHJeff Hostetler <git@jeffhostetler.com>
Date
Oct 30, 2020, 15:54 UTC
Message-ID
<4f1a1bab-7ac7-b8dd-acb2-6aeb04be3171@jeffhostetler.com>
In-Reply-To
<cover.1604006121.git.steadmon@google.com>
On 10/29/20 5:32 PM, Josh Steadmon wrote:
Show 5 quoted lines
> In order to more easily debug remote operations, it is useful to be able
> to inspect both client-side and server-side traces. This series allows
> clients to record the server's trace2 session ID, and vice versa, by
> advertising the SID in a new "trace2-sid" protocol capability.
> 

Very nice! This should be very helpful when matching up client and server commands.

Show 6 quoted lines
> Two questions in particular for reviewers:
> 
> 1) Is trace2/tr2_sid.h intended to be visible to the rest of the code,
>    or is the trace2/ directory supposed to be opaque implementation
>    detail? If the latter, would it be acceptable to move tr2_sid_get()
>    into trace2.h?

I put all the trace2-private stuff in that sub-directory and gave everything tr2_ prefixes to hide the details as much as I could (and as an alternative to the usual tendency of having everything be static within a massive .c file).

So, yeah, my intent was to make all of it opaque. So that just trace2.h contains the official API.

Perhaps in trace2.c you could create:
const char *trace2_session_id(void)
{
     return tr2_sid_get();
}
Show 7 quoted lines
> 
> 2) upload-pack generally takes configuration via flags rather than
>    gitconfig. From offline discussions, it sounds like this is an
>    intentional choice to limit potential vulnerability from malicious
>    configs in local repositories accessed via the file:// URL scheme. Is
>    it reasonable to load the trace2.announceSID option from config files
>    in upload-pack, or should this be changed to a flag?
I don't have the history to comment on this.

One thing to consider is that the SID for a Git process is built up from the SID of the parent and the unique data for the current process. So for example, if `git fetch` has SID `<sid1>` and it spawns `git upload-pack`, the child will have SID `<sid1>/<sid2>` and if that spawns `git index-pack`, that child will have `<sid1>/<sid2>/<sid3>`. This is very helpful when tracking down parent/child relationships and perf hunting.

This SID inheritance is passed via an environment variable to the child, which extends it and passes the longer version to its children.

So the value being passed between client and server over the protocol may look like `<sid1>/<sid2>/<sid3>` rather than just a single `<sid_x>` term. For your purposes, do you want or care if you get the single term or the full SID ?

Also, there's nothing to stop someone from seeding that environment variable in their shell with some mischief before launching the top-level Git command. So the above example might see the SID as `<mischief>/<sid1>/<sid2>/<sid3>`. I'm not sure if this could be abused when inserted into the V0/V1/V2 protocol or your logging facility.

     $ GIT_TRACE2_EVENT=1 GIT_TRACE2_PARENT_SID=hello git version
     {"event":"version","sid":"hello/20201030T154143.660608Z-H86606a97- 
  P00001d30",...}
     ...

So maybe we want to have a public API to return a pointer to just the final `<sid_x>` term ? (Then again, maybe I worry too much.)

Thanks, Jeff

Show 28 quoted lines
> 
> 
> 
> Josh Steadmon (10):
>    docs: new capability to advertise trace2 SIDs
>    docs: new trace2.advertiseSID option
>    upload-pack: advertise trace2 SID in v0 capabilities
>    receive-pack: advertise trace2 SID in v0 capabilities
>    serve: advertise trace2 SID in v2 capabilities
>    transport: log received server trace2 SID
>    fetch-pack: advertise trace2 SID in capabilities
>    upload-pack, serve: log received client trace2 SID
>    send-pack: advertise trace2 SID in capabilities
>    receive-pack: log received client trace2 SID
> 
>   Documentation/config/trace2.txt               |  4 +
>   .../technical/protocol-capabilities.txt       | 13 ++-
>   Documentation/technical/protocol-v2.txt       |  9 +++
>   builtin/receive-pack.c                        | 16 ++++
>   fetch-pack.c                                  | 11 +++
>   send-pack.c                                   |  9 +++
>   serve.c                                       | 19 +++++
>   t/t5705-trace2-sid-in-capabilities.sh         | 79 +++++++++++++++++++
>   transport.c                                   | 10 +++
>   upload-pack.c                                 | 23 +++++-
>   10 files changed, 190 insertions(+), 3 deletions(-)
>   create mode 100755 t/t5705-trace2-sid-in-capabilities.sh
> 
Previous: Josh SteadmonNext: Josh Steadmon
Message 12 of 66 in “Advertise trace2 SID in protocol capabilities”
  1. 00/10 Advertise trace2 SID in protocol capabilitiesJosh Steadmon, Oct 29, 2020
  2. 01/10 docs: new capability to advertise trace2 SIDsJosh Steadmon, Oct 29, 2020
  3. 02/10 docs: new trace2.advertiseSID optionJosh Steadmon, Oct 29, 2020
  4. 03/10 upload-pack: advertise trace2 SID in v0 capabilitiesJosh Steadmon, Oct 29, 2020
  5. 05/10 serve: advertise trace2 SID in v2 capabilitiesJosh Steadmon, Oct 29, 2020
  6. 04/10 receive-pack: advertise trace2 SID in v0 capabilitiesJosh Steadmon, Oct 29, 2020
  7. 06/10 transport: log received server trace2 SIDJosh Steadmon, Oct 29, 2020
  8. 07/10 fetch-pack: advertise trace2 SID in capabilitiesJosh Steadmon, Oct 29, 2020
  9. 08/10 upload-pack, serve: log received client trace2 SIDJosh Steadmon, Oct 29, 2020
  10. 09/10 send-pack: advertise trace2 SID in capabilitiesJosh Steadmon, Oct 29, 2020
  11. 10/10 receive-pack: log received client trace2 SIDJosh Steadmon, Oct 29, 2020
  12. Jeff HostetlerOct 30, 2020
  13. Josh SteadmonNov 2, 2020
  14. Junio C HamanoNov 3, 2020
  15. Jeff HostetlerNov 5, 2020
  16. Josh SteadmonNov 10, 2020
  17. Junio C HamanoOct 30, 2020
  18. 00/11 Advertise trace2 SID in protocol capabilitiesJosh Steadmon, Nov 2, 2020
  19. 02/11 docs: new trace2.advertiseSID optionJosh Steadmon, Nov 2, 2020
  20. Junio C HamanoNov 3, 2020
  21. Josh SteadmonNov 5, 2020
  22. Junio C HamanoNov 5, 2020
  23. Johannes SchindelinNov 6, 2020
  24. 01/11 docs: new capability to advertise trace2 SIDsJosh Steadmon, Nov 2, 2020
  25. Junio C HamanoNov 3, 2020
  26. Jeff HostetlerNov 5, 2020
  27. Ævar Arnfjörð BjarmasonNov 12, 2020
  28. Junio C HamanoNov 12, 2020
  29. Jeff HostetlerNov 12, 2020
  30. Josh SteadmonNov 11, 2020
  31. 03/11 trace2: add a public function for getting the SIDJosh Steadmon, Nov 2, 2020
  32. 05/11 receive-pack: advertise trace2 SID in v0 capabilitiesJosh Steadmon, Nov 2, 2020
  33. 04/11 upload-pack: advertise trace2 SID in v0 capabilitiesJosh Steadmon, Nov 2, 2020
  34. Junio C HamanoNov 3, 2020
  35. Josh SteadmonNov 5, 2020
  36. 06/11 serve: advertise trace2 SID in v2 capabilitiesJosh Steadmon, Nov 2, 2020
  37. Junio C HamanoNov 4, 2020
  38. 07/11 transport: log received server trace2 SIDJosh Steadmon, Nov 2, 2020
  39. Junio C HamanoNov 4, 2020
  40. Josh SteadmonNov 11, 2020
  41. Jeff HostetlerNov 12, 2020
  42. 08/11 fetch-pack: advertise trace2 SID in capabilitiesJosh Steadmon, Nov 2, 2020
  43. Junio C HamanoNov 4, 2020
  44. Josh SteadmonNov 5, 2020
  45. Junio C HamanoNov 5, 2020
  46. Josh SteadmonNov 11, 2020
  47. 09/11 upload-pack, serve: log received client trace2 SIDJosh Steadmon, Nov 2, 2020
  48. Junio C HamanoNov 4, 2020
  49. Josh SteadmonNov 5, 2020
  50. 10/11 send-pack: advertise trace2 SID in capabilitiesJosh Steadmon, Nov 2, 2020
  51. 11/11 receive-pack: log received client trace2 SIDJosh Steadmon, Nov 2, 2020
  52. Junio C HamanoNov 3, 2020
  53. 00/11 Advertise session ID in protocol capabilitiesJosh Steadmon, Nov 11, 2020
  54. 06/11 serve: advertise session ID in v2 capabilitiesJosh Steadmon, Nov 11, 2020
  55. 08/11 fetch-pack: advertise session ID in capabilitiesJosh Steadmon, Nov 11, 2020
  56. 07/11 transport: log received server session IDJosh Steadmon, Nov 11, 2020
  57. 10/11 send-pack: advertise session ID in capabilitiesJosh Steadmon, Nov 11, 2020
  58. 09/11 upload-pack, serve: log received client session IDJosh Steadmon, Nov 11, 2020
  59. 11/11 receive-pack: log received client session IDJosh Steadmon, Nov 11, 2020
  60. 05/11 receive-pack: advertise session ID in v0 capabilitiesJosh Steadmon, Nov 11, 2020
  61. 04/11 upload-pack: advertise session ID in v0 capabilitiesJosh Steadmon, Nov 11, 2020
  62. 03/11 trace2: add a public function for getting the SIDJosh Steadmon, Nov 11, 2020
  63. 02/11 docs: new transfer.advertiseSID optionJosh Steadmon, Nov 11, 2020
  64. 01/11 docs: new capability to advertise session IDsJosh Steadmon, Nov 11, 2020
  65. Junio C HamanoNov 25, 2020
  66. Josh SteadmonNov 25, 2020

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.