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

MSan failures in pack-bitmap

From
Kyle Lippincott <spectral@google.com>
Date
Jun 8, 2024, 02:43 UTC
Message-ID
<CAO_smVjSy6j7jpSxHNsxzJfxnHwjLphsqu5jwd8TBhMLp72XPw@mail.gmail.com>
While running t/t5326-multi-pack-bitmaps:

test 24: expecting success of 5326.24 'clone from bitmapped repository': rm -fr clone.git && git clone --no-local --bare . clone.git && git rev-parse HEAD >expect && git --git-dir=clone.git rev-parse HEAD >actual && test_cmp expect actual

Cloning into bare repository 'clone.git'... remote: ==7474==WARNING: MemorySanitizer: use-of-uninitialized-value remote: #0 0x55c5cd191dde in try_partial_reuse pack-bitmap.c:1887:8 remote: #1 0x55c5cd191dde in reuse_partial_packfile_from_bitmap_1 pack-bitmap.c:2001:8 remote: #2 0x55c5cd191dde in reuse_partial_packfile_from_bitmap pack-bitmap.c:2105:3 remote: #3 0x55c5cce0bd0e in get_object_list_from_bitmap builtin/pack-objects.c:4043:3 remote: #4 0x55c5cce0bd0e in get_object_list builtin/pack-objects.c:4156:27 remote: #5 0x55c5cce0bd0e in cmd_pack_objects builtin/pack-objects.c:4596:3 remote: #6 0x55c5ccc8fac8 in run_builtin git.c:474:11 remote: #7 0x55c5ccc8d660 in handle_builtin git.c:729:3 remote: #8 0x55c5ccc8b634 in run_argv git.c:793:4 remote: #9 0x55c5ccc8b634 in cmd_main git.c:928:19 remote: #10 0x55c5ccf10a5b in main common-main.c:62:11 remote: #11 0x7f9ef142e3d3 in __libc_start_main remote: #12 0x55c5ccbf28e9 in _start remote: remote: Uninitialized value was stored to memory at remote: #0 0x55c5cd191dd7 in try_partial_reuse pack-bitmap.c:1888:15 remote: #1 0x55c5cd191dd7 in reuse_partial_packfile_from_bitmap_1 pack-bitmap.c:2001:8 remote: #2 0x55c5cd191dd7 in reuse_partial_packfile_from_bitmap pack-bitmap.c:2105:3 remote: #3 0x55c5cce0bd0e in get_object_list_from_bitmap builtin/pack-objects.c:4043:3 remote: #4 0x55c5cce0bd0e in get_object_list builtin/pack-objects.c:4156:27 remote: #5 0x55c5cce0bd0e in cmd_pack_objects builtin/pack-objects.c:4596:3 remote: #6 0x55c5ccc8fac8 in run_builtin git.c:474:11 remote: #7 0x55c5ccc8d660 in handle_builtin git.c:729:3 remote: #8 0x55c5ccc8b634 in run_argv git.c:793:4 remote: #9 0x55c5ccc8b634 in cmd_main git.c:928:19 remote: #10 0x55c5ccf10a5b in main common-main.c:62:11 remote: #11 0x7f9ef142e3d3 in __libc_start_main remote: #12 0x55c5ccbf28e9 in _start remote: remote: Uninitialized value was created by a heap allocation remote: #0 0x55c5ccc052ca in realloc msan/msan_interceptors.cpp:1009:3 remote: #1 0x55c5cd3d04d6 in xrealloc wrapper.c:137:8 remote: #2 0x55c5cd190d95 in reuse_partial_packfile_from_bitmap pack-bitmap.c:2091:3 remote: #3 0x55c5cce0bd0e in get_object_list_from_bitmap builtin/pack-objects.c:4043:3 remote: #4 0x55c5cce0bd0e in get_object_list builtin/pack-objects.c:4156:27 remote: #5 0x55c5cce0bd0e in cmd_pack_objects builtin/pack-objects.c:4596:3 remote: #6 0x55c5ccc8fac8 in run_builtin git.c:474:11 remote: #7 0x55c5ccc8d660 in handle_builtin git.c:729:3 remote: #8 0x55c5ccc8b634 in run_argv git.c:793:4 remote: #9 0x55c5ccc8b634 in cmd_main git.c:928:19 remote: #10 0x55c5ccf10a5b in main common-main.c:62:11 remote: #11 0x7f9ef142e3d3 in __libc_start_main remote: #12 0x55c5ccbf28e9 in _start remote: remote: SUMMARY: MemorySanitizer: use-of-uninitialized-value pack-bitmap.c:1887:8 in try_partial_reuse remote: Exiting error: git upload-pack: git-pack-objects died with error. fatal: git upload-pack: aborting due to possible repository corruption on the remote side. remote: aborting due to possible repository corruption on the remote side. fatal: early EOF fatal: fetch-pack: invalid index-pack output not ok 24 - clone from bitmapped repository # # rm -fr clone.git && # git clone --no-local --bare . clone.git && # git rev-parse HEAD >expect && # git --git-dir=clone.git rev-parse HEAD >actual && # test_cmp expect actual #

There are similar failures in test 25, 198, 199, 319, and 320. ---

I believe what's happening is that pack-bitmap.c:2091 grows the packs list and sets up some of the fields, but doesn't set pack_int_id. We then use it at pack-bitmap.c:1888.

I investigated, but couldn't prove to myself what value should be placed there while growing it, or if it's incorrect to read from it in this case (so we shouldn't be in pack-bitmap.c:1888 with this pack).

Reproducing is potentially non-trivial. This may work:

make -j CFLAGS="-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -g -O2" CC=clang && \ make -C t t5326-multi-pack-bitmaps.sh GIT_TEST_OPTS="--verbose --debug"

Next: Jeff King
Message 1 of 10 in “MSan failures in pack-bitmap”
  1. Kyle LippincottJun 8, 2024
  2. Jeff KingJun 8, 2024
  3. Taylor BlauJun 9, 2024
  4. Junio C HamanoJun 9, 2024
  5. Taylor BlauJun 9, 2024
  6. Junio C HamanoJun 9, 2024
  7. Taylor BlauJun 9, 2024
  8. Taylor BlauJun 9, 2024
  9. Jeff KingJun 11, 2024
  10. Jeff KingJun 11, 2024

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.