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

Re: [PATCH] revision: fix missing null for freed memory

From
Patrick Steinhardt <ps@pks.im>
Date
Feb 12, 2025, 05:30 UTC
Message-ID
<Z6wx2a4LUcOjU79p@pks.im>
In-Reply-To
<20250211212909.GA3113114@coredump.intra.peff.net>
On Tue, Feb 11, 2025 at 04:29:09PM -0500, Jeff King wrote:
Show 28 quoted lines
> On Tue, Feb 11, 2025 at 03:22:28PM -0500, D. Ben Knoble wrote:
> 
> > 2.{30,35}.0 fails to recognize --no-graph, so I checked "git log --grep no-graph
> > origin/master" with "git describe --contains" and decided that 2.36.0 was first
> > release recognizing --no-graph, but it didn't build for me (possibly an issue on
> > my end). I got 2.37.0 built, and it was "good," so that's where I started.
> > 
> > Here's my "bisect run" script.
> > 
> >     #! /bin/sh -x
> >     make || exit 125
> >     # segfault has exit >128
> >     ./bin-wrappers/git --no-pager log -2 --graph --no-graph --patch
> > --cc || exit 1
> 
> I don't think this is quite enough. The problem is a use-after-free, so
> the behavior is undefined. Depending on whether that heap block is
> reused, it might work just fine, or output garbage data, or segfault.
> 
> I'd have _thought_ it would usually just segfault, but it almost always
> just output garbage for me. Building with:
> 
>   make SANITIZE=address,undefined
> 
> is a good way to get reliable results for this kind of memory error.
> Doing that shows that v2.37.0 is actually bad. And bisecting shows that
> it has been broken since 087c745833 (log: add a --no-graph option,
> 2022-02-11), which is not too surprising.
Thanks all for bisecting :)
Patrick
Previous: Junio C HamanoNext: Ben Knoble
Message 11 of 12 in “revision: fix missing null for freed memory”
  1. revision: fix missing null for freed memoryEmily M Klassen, Feb 8, 2025
  2. Junio C HamanoFeb 8, 2025
  3. Junio C HamanoFeb 10, 2025
  4. Emily KlassenFeb 10, 2025
  5. Junio C HamanoFeb 13, 2025
  6. Patrick SteinhardtFeb 11, 2025
  7. D. Ben KnobleFeb 11, 2025
  8. D. Ben KnobleFeb 11, 2025
  9. Jeff KingFeb 11, 2025
  10. Junio C HamanoFeb 11, 2025
  11. Patrick SteinhardtFeb 12, 2025
  12. Ben KnobleFeb 13, 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.