Git development
 help / color / mirror / Atom feed
* [PATCH 0/2] packfile: fix corruption due to stale delta base cache entries
@ 2026-10-02  7:34 Patrick Steinhardt
  2026-10-02  7:34 ` [PATCH 1/2] packfile: move around `close_pack()` Patrick Steinhardt
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Patrick Steinhardt @ 2026-10-02  7:34 UTC (permalink / raw)
  To: git; +Cc: Guillaume Chauvel, Philippe Blain

Hi,

this small patch series fixes the bug reported in [1].

To summarize: we never evict delta base cache entries when closing the
owning pack. The cache may thus contain stale entries which are keyed by
by the memory address of `struct packed_git` and the offset of the entry
in the packfile. Now when allocating a new pack that happens to have the
exact same address and that has entries sitting at the same offset, we
may try to use these stale entries and thus yield corrupted data.

This all sounds very unlikely, but the interesting part is that this can
be reproduced by using recursive merges with submodules, as we open and
close the object databases of each respective submodule. And if they
have similar packfiles, then we may trigger the bug.

The series is built on top of v2.56.0.

Thanks!

Patrick

[1]: <CAP4DsUexEmm1qo6jH+Qzy+n3dQs_OCJ8yg=ReF+aVrcTrC7NeQ@mail.gmail.com>

---
Patrick Steinhardt (2):
      packfile: move around `close_pack()`
      packfile: fix corruption due to stale delta base cache entries

 packfile.c                 | 33 ++++++++++++++++++++++----------
 t/t6437-submodule-merge.sh | 47 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 10 deletions(-)


---
base-commit: a018953688f1b10bddf91bff8747068f5f4746a4
change-id: 20261002-pks-packfile-stale-delta-base-cache-0d4730487643


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

end of thread, other threads:[~2026-10-07 18:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-02  7:34 [PATCH 0/2] packfile: fix corruption due to stale delta base cache entries Patrick Steinhardt
2026-10-02  7:34 ` [PATCH 1/2] packfile: move around `close_pack()` Patrick Steinhardt
2026-10-02 19:02   ` Mark C. Chu-Carroll
2026-10-02 19:38     ` Patrick Steinhardt
2026-10-02  7:34 ` [PATCH 2/2] packfile: fix corruption due to stale delta base cache entries Patrick Steinhardt
2026-10-02 13:34   ` Guillaume Chauvel
2026-10-02 19:34     ` Patrick Steinhardt
2026-10-02 17:48   ` Philippe Blain
2026-10-02 19:37     ` Patrick Steinhardt
2026-10-02 22:23   ` Jeff King
2026-10-05  5:32     ` Patrick Steinhardt
2026-10-07  8:18       ` Jeff King
2026-10-07 18:00         ` Junio C Hamano
2026-10-06 10:20 ` [PATCH v2 0/2] " Patrick Steinhardt
2026-10-06 10:20   ` [PATCH v2 1/2] packfile: move around `close_pack()` Patrick Steinhardt
2026-10-06 10:20   ` [PATCH v2 2/2] packfile: fix corruption due to stale delta base cache entries Patrick Steinhardt
2026-10-06 19:57     ` Junio C Hamano
2026-10-07  5:29       ` Patrick Steinhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox