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

[PATCH 0/4] midx: verify MIDX checksum before reusing

From
Taylor Blau <me@ttaylorr.com>
Date
Jun 23, 2021, 18:39 UTC
Message-ID
<cover.1624473543.git.me@ttaylorr.com>

Here is a small series that came out of a corruption we noticed at GitHub. The corruption is described in the third patch, but the gist is this:

  - After writing a MIDX, we experience a disk failure that corrupts the
    contents of the repository's MIDX.
  - We later go to write another MIDX, notice that one is already there, and
    then blindly reuse its data without checking its validity, resulting in a
    MIDX that contains corrupt data, but whose trailing checksum matches the
    preceding contents.

This series checks the validity of the trailing checksum when reusing a MIDX while writing a new one, as well as a few other related fix-ups. That should be sufficient to avoid propagating corrupt data forward while writing a MIDX.

We could go further here and run 'git multi-pack-index verify' on the existing MIDX while writing a new one, but the point of this reuse is to avoid having to re-compute/verify the contents of an existing MIDX. So a more lightweight option is pursued here, but alternatives are discussed in 3/4.

Thanks in advance for your review.
Taylor Blau (4):
  csum-file: introduce checksum_valid()
  commit-graph: rewrite to use checksum_valid()
  midx: don't reuse corrupt MIDXs when writing
  midx: report checksum mismatches during 'verify'
 commit-graph.c              | 14 ++++++--------
 csum-file.c                 | 16 ++++++++++++++++
 csum-file.h                 |  3 +++
 midx.c                      | 13 +++++++++++++
 pack-check.c                | 11 +----------
 t/t5319-multi-pack-index.sh | 13 +++++++++++++
 6 files changed, 52 insertions(+), 18 deletions(-)
-- 
2.31.1.163.ga65ce7f831
Next: Taylor Blau
Message 1 of 16 in “midx: verify MIDX checksum before reusing”
  1. 0/4 midx: verify MIDX checksum before reusingTaylor Blau, Jun 23, 2021
  2. 1/4 csum-file: introduce checksum_valid()Taylor Blau, Jun 23, 2021
  3. Jeff KingJun 24, 2021
  4. 2/4 commit-graph: rewrite to use checksum_valid()Taylor Blau, Jun 23, 2021
  5. Jeff KingJun 24, 2021
  6. 3/4 midx: don't reuse corrupt MIDXs when writingTaylor Blau, Jun 23, 2021
  7. Jeff KingJun 24, 2021
  8. 4/4 midx: report checksum mismatches during 'verify'Taylor Blau, Jun 23, 2021
  9. Bagas SanjayaJun 24, 2021
  10. Jeff KingJun 24, 2021
  11. SZEDER GáborNov 10, 2021
  12. Jeff KingNov 11, 2021
  13. Taylor BlauNov 16, 2021
  14. t5319: corrupt more bytes of the midx checksumJeff King, Nov 16, 2021
  15. Taylor BlauNov 16, 2021
  16. Derrick StoleeNov 16, 2021

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.