From: Farid Zakaria Date: Sun, 01 Nov 2026 23:29:24 GMT Subject: [PATCH 0/2] credential-cache: fix two races when daemons start at once Message-ID: <20261101-fz-credential-cache-race-v1-0-28f0bac51e11@gmail.com> 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