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

Re: t1450-fsck (sometimes/often) failes on Mac OS X

From
Thomas Rast <trast@inf.ethz.ch>
Date
Jul 28, 2012, 16:00 UTC
Message-ID
<87hasrdgej.fsf@thomas.inf.ethz.ch>
In-Reply-To
<20120728154320.GA98893@book.hvoigt.net>
Heiko Voigt <hvoigt@hvoigt.net> writes:
Show 5 quoted lines
>         if (!git_index_file) {
> -               git_index_file = xmalloc(strlen(git_dir) + 7);
> +               git_index_file = xmalloc(strlen(git_dir) + 7 + 8);
>                 sprintf(git_index_file, "%s/index", git_dir);
>         }
[...]
> -       if (!memcmp(ent->base, objdir, pfxlen)) {
> +       objdirlen = strlen(objdir);
> +       if (!memcmp(ent->base, objdir, pfxlen > objdirlen ? objdirlen : pfxlen)) {
[...]
Show 5 quoted lines
> Initialized empty Git repository in /Users/hvoigt/Repository/git/t/trash directory.t1450-fsck/another/.git/
> ==42686== Invalid read of size 8
> ==42686==    at 0x100625064: bcmp (in /usr/lib/libSystem.B.dylib)
> ==42686==    by 0x100112846: link_alt_odb_entries (in /Users/hvoigt/Repository/git/t/valgrind/../../git)
> ==42686==    by 0x1001129C0: read_info_alternates (in /Users/hvoigt/Repository/git/t/valgrind/../../git)
[...]
> ==42686==  Address 0x100faca78 is 8 bytes inside a block of size 13 alloc'd
> ==42686==    at 0x10029C679: malloc (vg_replace_malloc.c:266)
> ==42686==    by 0x1001349CD: xmalloc (in /Users/hvoigt/Repository/git/t/valgrind/../../git)
> ==42686==    by 0x1000C23F5: setup_git_env (in /Users/hvoigt/Repository/git/t/valgrind/../../git)

To me that looks just like a false positive. memcmp (which seems to be the same as bcmp) can load 8 bytes from an aligned address even if these are only partially within the block being compared, since an aligned load can never partially fault (it must all be within the same page). Valgrind normally substitutes its own routines for memcmp etc. to correctly handle this, but this does not seem to happen in your case for some reason.

Then again I am not entirely sure how you could verify that this theory is correct :-)

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Heiko Voigt
Message 14 of 14 in “t1450-fsck (sometimes/often) failes on Mac OS X”
  1. Torsten BögershausenJul 14, 2012
  2. Jeff KingJul 15, 2012
  3. Torsten BögershausenJul 15, 2012
  4. Torsten BögershausenSep 19, 2012
  5. Junio C HamanoSep 19, 2012
  6. Torsten BögershausenSep 19, 2012
  7. Torsten BögershausenOct 2, 2012
  8. Junio C HamanoOct 2, 2012
  9. Junio C HamanoOct 2, 2012
  10. Torsten BögershausenOct 3, 2012
  11. Thomas RastJul 16, 2012
  12. Torsten BögershausenJul 16, 2012
  13. Heiko VoigtJul 28, 2012
  14. Thomas RastJul 28, 2012

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.