From: Taylor Blau <me@ttaylorr.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Fabian Stelzer <fs@gigacodes.de>,
Junio C Hamano <gitster@pobox.com>,
Git List Mailing <git@vger.kernel.org>
Subject: Re: git ssh signing changed broke tag merge message contents
Date: Mon, 10 Jan 2022 12:19:46 -0500 [thread overview]
Message-ID: <YdxqshqXB/+ApOn2@nand.local> (raw)
In-Reply-To: <CAHk-=whXPxWL7z3GiPkaDt+yygrRmagrYUnib7Lx=Vvrqx2ufg@mail.gmail.com>
On Mon, Jan 10, 2022 at 08:42:07AM -0800, Linus Torvalds wrote:
> So I made the mistake of updating my git tree as I started doing my
> merge window for 5.17, and suddenly all the messages from signed tags
> disappeared from the merge commits.
>
> I bisected it to commit 02769437e1 ("ssh signing: use sigc struct to
> pass payload"), but haven't done any other analysis.
Thanks for the reproduction and bisection.
> I assume it's the change to fmt-merge-msg.c, but have no time to actually check.
Yes, 02769437e1 appears to introduces an inadvertent use-after-free.
I'll write up the details and post the patch shortly, but an easy fix
is:
--- 8< ---
diff --git a/fmt-merge-msg.c b/fmt-merge-msg.c
index e5c0aff2bf..baca57d5b6 100644
--- a/fmt-merge-msg.c
+++ b/fmt-merge-msg.c
@@ -541,7 +541,6 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
else
strbuf_addstr(&sig, sigc.output);
}
- signature_check_clear(&sigc);
if (!tag_number++) {
fmt_tag_signature(&tagbuf, &sig, buf, len);
@@ -565,6 +564,7 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
}
strbuf_release(&payload);
strbuf_release(&sig);
+ signature_check_clear(&sigc);
next:
free(origbuf);
}
--- >8 ---
Our coverage in t6200 (which should have ordinarily caught such a bug)
is lacking and does not search for the tag message in fmt-merge-msg's
output.
Thanks,
Taylor
next prev parent reply other threads:[~2022-01-10 17:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-10 16:42 git ssh signing changed broke tag merge message contents Linus Torvalds
2022-01-10 17:19 ` Taylor Blau [this message]
2022-01-10 17:22 ` Linus Torvalds
2022-01-10 17:31 ` Junio C Hamano
2022-01-10 21:19 ` [PATCH] fmt-merge-msg: prevent use-after-free with signed tags Taylor Blau
2022-01-10 21:38 ` Junio C Hamano
2022-01-11 8:41 ` Fabian Stelzer
2022-01-11 15:42 ` Taylor Blau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YdxqshqXB/+ApOn2@nand.local \
--to=me@ttaylorr.com \
--cc=fs@gigacodes.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).