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

[BUG] git crashes with a SIGBUS on sparc64 during pull

From
KKoakuma <koachan@protonmail.com>
Date
Jan 17, 2025, 03:30 UTC
Message-ID
<xd6Mn7uXpDxaT8zF28BwOIdV98lnvm3S0rBgxmm97nuRW3z0GQSUi_KeYe0fUuRfz8rCgo6Uialw5rnraqp5tjzMFQkFH0MZV_n4fEQg8go=@protonmail.com>

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
1. Compile git with clang (this doesn't seem to happen with GCC, oddly)
2. Do a `git pull` on a repository that will trigger the `unpack-objects` code
What did you expect to happen? (Expected behavior)
Pull succeeds
What happened instead? (Actual behavior)

Pull fails with this error: remote: Enumerating objects: 7, done. remote: Counting objects: 100% (5/5), done. error: unpack-objects died of signal 10 fatal: unpack-objects failed

What's different between what you expected and what actually happened?
The pull process crashes with a SIGBUS.
Anything else you want to add:

re: unpack-objects, I don't know how to specifically trigger that code, but I know that once `unpack-objects` is triggered it will reliably crash with the error above.

According to gdb, the crash happens on this line: #0 0x000001000019ca18 in cmd_unpack_objects (argc=<optimized out>, argv=0x1000063a4e0, prefix=<optimized out>, repo=<optimized out>) at builtin/unpack-objects.c:653 653 hdr->hdr_signature = htonl(PACK_SIGNATURE);

Overaligning the `buffer` declaration in the same file to try to get around possible alignment issues seems to be able to prevent the crash, but I don't know if it would be a proper fix for it.

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info]
git version:
git version 2.48.1.262.g85cc9f2d1e
cpu: sparc64
built from commit: 85cc9f2d1ee4d65cb1edb00d4f56863185a53e0f
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
libcurl: 8.10.1
OpenSSL: OpenSSL 3.3.2 3 Sep 2024
zlib: 1.3.1
uname: Linux 6.6.30-sparc64-clang+ #1 SMP Sat Oct 26 21:22:10 WIB 2024 sparc64
compiler info: clang: 19.1.4
libc info: glibc: 2.40
$SHELL (typically, interactive shell): /bin/bash
[Enabled Hooks]
Next: Jeff King
Message 1 of 22 in “[BUG] git crashes with a SIGBUS on sparc64 during pull”
  1. KoakumaJan 17, 2025
  2. Jeff KingJan 17, 2025
  3. Jeff KingJan 17, 2025
  4. 1/3 packfile: factor out --pack_header argument parsingJeff King, Jan 17, 2025
  5. Junio C HamanoJan 17, 2025
  6. Jeff KingJan 18, 2025
  7. KoakumaJan 18, 2025
  8. 2/3 parse_pack_header_option(): avoid unaligned memory writesJeff King, Jan 17, 2025
  9. Junio C HamanoJan 18, 2025
  10. Jeff KingJan 18, 2025
  11. 3/3 index-pack, unpack-objects: use skip_prefix to avoid magic numberJeff King, Jan 17, 2025
  12. KoakumaJan 17, 2025
  13. Jeff KingJan 18, 2025
  14. KoakumaJan 18, 2025
  15. 0/5 git crashes with a SIGBUS on sparc64 during pullJeff King, Jan 19, 2025
  16. 1/5 bswap.h: squelch potential sparse -Wcast-truncate warningsJeff King, Jan 19, 2025
  17. 2/5 packfile: factor out --pack_header argument parsingJeff King, Jan 19, 2025
  18. 3/5 parse_pack_header_option(): avoid unaligned memory writesJeff King, Jan 19, 2025
  19. 4/5 index-pack, unpack-objects: use get_be32() for reading pack headerJeff King, Jan 19, 2025
  20. 5/5 index-pack, unpack-objects: use skip_prefix to avoid magic numberJeff King, Jan 19, 2025
  21. KoakumaJan 20, 2025
  22. Junio C HamanoJan 21, 2025

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.