All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] credential-cache: fix two races when daemons start at once
@ 2026-11-01 23:29 Farid Zakaria
  2026-11-01 23:29 ` [PATCH 1/2] credential-cache--daemon: allow a concurrently created socket dir Farid Zakaria
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Farid Zakaria @ 2026-11-01 23:29 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Patrick Steinhardt, M Hickford,
	Johannes Schindelin, Jeff Hostetler, Farid Zakaria

When no credential-cache daemon is running, two "git credential-cache
store" which run at the same time each try to start a daemon.

The second daemon unlinks the first one's socket and binds its own,
which means any credential stored by the first one is lost.

By products of this race:
  - "git credential-cache get" does not return that credential;
  - "git credential-cache exit" stops only the second daemon, and the
   first keeps the password in memory until it expires;
  - when the first daemon exits, its tempfile handler removes
   the socket of the second daemon, whose credentials are then lost
   too.

This can happen whenever two git commands store a password at the
same moment, for example parallel submodule fetches over HTTPS.

I found this with Rewind [1], a deterministic VM I am building that
replays a program under many thread schedules until one fails. 

Context from some history spelunking with an AI:
  Jeff noted in 2021 that the daemon's socket setup is racy [2], and
  expected the worst case to be a daemon that waits 30 seconds for data
  before it exits. That holds only if the losing daemon gets no
  credential, but its own client stores one right after it starts.

[1] https://rewindvm.dev/
[2] https://lore.kernel.org/git/YCK5K%2FnK4tGnTvou@coredump.intra.peff.net/

---
Farid Zakaria (2):
      credential-cache--daemon: allow a concurrently created socket dir
      credential-cache--daemon: do not take over a running daemon's socket

 builtin/credential-cache--daemon.c | 43 +++++++++++++++++++++++++++++---------
 t/t0301-credential-cache.sh        | 23 ++++++++++++++++++++
 2 files changed, 56 insertions(+), 10 deletions(-)


---
base-commit: 50fe5cc63f9cd6e89b87a2c9ccf96a444f4cfdb7
change-id: 20261101-fz-credential-cache-race-4504110c6415


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-11-04 19:53 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-01 23:29 [PATCH 0/2] credential-cache: fix two races when daemons start at once Farid Zakaria
2026-11-01 23:29 ` [PATCH 1/2] credential-cache--daemon: allow a concurrently created socket dir Farid Zakaria
2026-11-03  8:01   ` Patrick Steinhardt
2026-11-04 18:25     ` Farid Zakaria
2026-11-04  2:58   ` Jeff King
2026-11-01 23:29 ` [PATCH 2/2] credential-cache--daemon: do not take over a running daemon's socket Farid Zakaria
2026-11-03  8:01   ` Patrick Steinhardt
2026-11-04 18:28     ` Farid Zakaria
2026-11-03 17:24   ` Junio C Hamano
2026-11-04  3:07   ` Jeff King
2026-11-04 19:53 ` [PATCH v2 0/3] credential-cache: fix two races when daemons start at once Farid Zakaria
2026-11-04 19:53   ` [PATCH v2 1/3] credential-cache--daemon: do not apply core.sharedRepository Farid Zakaria
2026-11-04 19:53   ` [PATCH v2 2/3] credential-cache--daemon: allow a concurrently created socket dir Farid Zakaria
2026-11-04 19:53   ` [PATCH v2 3/3] credential-cache--daemon: do not take over a running daemon's socket Farid Zakaria

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.