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

Re: [BUG] rebase: can write reflog with uninit. `action` string

From
Pphillip.wood123@gmail.com <phillip.wood123@gmail.com>
Date
May 1, 2025, 14:10 UTC
Message-ID
<a834c708-8904-44c5-9481-5f796cf0054e@gmail.com>
In-Reply-To
<20250429215155.GA36727@coredump.intra.peff.net>
Hi Peff
On 29/04/2025 22:51, Jeff King wrote:
Show 22 quoted lines
> On Tue, Apr 29, 2025 at 09:40:13PM +0200, Kristoffer Haugsbakk wrote:
> 
>> On Tue, Apr 29, 2025, at 11:22, Phillip Wood wrote:
>>>> #0  run_git_commit (defmsg=0x555555babe70 "<repo path>/MERGE_MSG", opts=0x7fffffffc070, flags=0) at sequencer.c:1158
>>>
>>> Thanks for the backtrace. It would be useful to know what's stored in
>>> opts->ctx->reflog_message at this point if it's not too much trouble
>>> please can you run "print *opts" and "print *opts->ctx" here.
>>
>> Today I ran on f65182a99e5 (The ninth batch, 2025-04-24) at
>> sequencer.c:1148.  I was never able to reproduce this
>> `opts->ctx->reflog_message` having a weird value with GDB today.  The
>> reflog was also fine.
>>
>> Then I ran without GDB and I got the weird reflog that I expected.
> 
> Have you tried building with "make SANITIZE=address,undefined"?
> 
> This is a wild guess, but since ctx->reflog_message is pointing to a
> static strbuf, it could be a use after free if the strbuf is reallocated
> due to another call to reflog_message(), but we are still holding the
> old pointer via ctx->reflog_message.

Oh, nice insight. I'd forgotten we had callers of reflog_message() that didn't store the result in ctx->reflog_message. One of those callers is in do_reset() which due to the way the todo list gets constructed is likely to be called just before do_merge().

Thanks
Phillip
Previous: Junio C Hamano
Message 12 of 12 in “[BUG] rebase: can write reflog with uninit. `action` string”
  1. Kristoffer HaugsbakkApr 28, 2025
  2. Phillip WoodApr 29, 2025
  3. Kristoffer HaugsbakkApr 29, 2025
  4. Jeff KingApr 29, 2025
  5. Kristoffer HaugsbakkApr 30, 2025
  6. Jeff KingMay 1, 2025
  7. phillip.wood123@gmail.comMay 1, 2025
  8. Jeff KingMay 1, 2025
  9. Junio C HamanoMay 1, 2025
  10. Jeff KingMay 1, 2025
  11. Junio C HamanoMay 1, 2025
  12. phillip.wood123@gmail.comMay 1, 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.