From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.151 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796303932; b=BMs591ZK8Eo2kKglAxdBDO8fq33IX1U+wkFoBlkvCN0mMlnpa/5pwfKhqJuChoSrFznU wWRxuMVDc/mPv0y0zXJLyhyCCFYi+5sk/O6/Ri4fRWlAmYK++GneaaZzEprO/nXNNeCqV WNdZly0SMD772eX+pS3Mo16CzQopDpu60xh45IJuf5QWPouStccq+snBZAjW/4j8psnXG BH94IPa9lg/Wuoi+aX3XOaPH6R4Y6hweK9PWIsw/uq3hVJxl4+xmZKTlsFA8/co3uvtUu Dd8PHYOp2ixY2SfyfmTw/aUaa4PWL5Cz/OYpi81iDB9oenrRRnLVXI7RTl/2K/b+DKA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796303932; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=atZkdPWz5GxUmCwGaBEViEfnhYu5mqw3Cx7Ug7qyCqQ=; b=KNXAdwLpdjvni9qqUPPPcxT7QTrfcNIXPFO4na4qMGczLYyVvhWgrpZ6oUq9VvqSwyvH Sk4uwc0v68+Qmf8krrq47Tko61Ju/y+fCDGJK6a/csiQjM1fdzyQ6ZAL8wTTosex1Ds2t 6Ga9cR6kDAod3SS/A+PjxvFO/HVLkIrr1tG+Q0p6IBe8rjYk0u6bFMiEmJfBM5tdVxknB WzsHPZazOpFWEes+HBaCdeH3WD7oHuVhyOC90B5IjeAYWjW7eS50vHro9eUEu0a+GpmgS fAzT8qCvkuq4vgv/ODO3nks8YVUno+Ers/OwWe3M8+V7YVpEuyNDyLDMVfr80F6ka9w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b=k71C6jdm; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=TtmlTRuE; arc=none smtp.remote-ip=103.168.172.151 Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 174CD606A322 for ; Thu, 3 Dec 2026 13:18:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 174CD606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b=k71C6jdm; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=TtmlTRuE Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 31DD3EC1DB2 for ; Thu, 3 Dec 2026 08:18:51 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Thu, 03 Dec 2026 08:18:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1796303931; x=1796390331; bh=atZkdPWz5G xUmCwGaBEViEfnhYu5mqw3Cx7Ug7qyCqQ=; b=k71C6jdm7B4Bqu6tUXXAMhOH1z a295YAGhinUSPX8IB1xuW41vKicW7FkVtOag18K0WsLfYnjhiwgxGfMCjLdsHrHU 8PbbpSrO9RguF6hrrh1w+7U0arhRphNZ8mTxDRCyuBkkuEsqGrfeb9DIE5cT/vgr bEqAAnhhRgB7SyNzRFsTestA4W0+Au3ikSzrDyRsc9JIC09A3cFkjM/3Bhh6XfzR WGp5yPPKnXFscn4/6Y5WGJ4QS7htxI+Jc3Wzn0BcB56pYM9so6b0P+0FzF363i8s mqvb5xgMsDRBYD62H8bWqesKot0YjDFBHkHazbCw50OicERcZNAw/hrvVaYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1796303931; x=1796390331; bh=atZkdPWz5GxUmCwGaBEViEfnhYu5mqw3Cx7 Ug7qyCqQ=; b=TtmlTRuEDM0jmS4BlL8lN1FW4Gibf8/AMROxgsKbarzsNaQM0Zo QfZA7w+gqTjdPi5C9moXbTflCdF4Z+F8ikVGy4/OetZVwoJudyOuZjKW6eWdMnhi hyF0LN1jq7U5y9PQ6jxeY3F5mb6K1RG0+o6KOrk1chK/gDmSJ6xPbyldcL5KdDbL n0UygYLbztv6DeCESRfCX7dX4HVXiH0tWY9/W2lp2V645E39CEqdTmYwQfY0ipct vSLTZrqI/lHFj7AygarrWSXWoq6I/ZLppGkwUGtnfhqfakPd4hGKNIQdXV5oaNAl FlsaLlS1pqM/d3o5+1krGgntRgfI0WLpU3A== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=pks.im a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796303931; d=pks.im; mf=PHBzQHBrcy5pbT4=; rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+; s=fm3:rsa-sha256:eukCQUf740nng2UCgJMYRkk+aBYJbzhLA9GDeEt3mAPXtB7 dOeNT8yUN3QAanxGMWKGu6OeirjKmKCKj2048gyWfsUHNQUsKiU2mV9Q5nI8IAMk TsMaXKEfOsgLDE2MiMhKWEpxgc4cy/AFJn8dev+V3CP922xWtjp8FxG3GqA1JdiG tGrZVOm92Z6lTD9Z9DF2oceA41vPgY0MQsw/5gQoJy7DCAv0/yi5L1s+bHTAejOZ eJBY4ZXfeDSZr4z8AndY79u8FmzIFHWM6g10t8Wy1lWBvkW6rg3jOlzBHip1nxyd eUPwGMemH0iaGx2s26cHiVo+nkWaw7oO9ZCcAXQ==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-disposition,content-type,date,feedback-id,from, in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:+ob/Bn3ZTL0XndtTrW9QeLiO/Ygio3Gi2yqF27LAYWk=:VILlZ28gQ6x8OYEZSSqw+xGarwAP7W2ieX+6iY5CRX0=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTFXWjLeNrWlNbJTH829hpT8UbEr8WcuH2hWUhqqF7oB0llxr+uld+UALLgJto9g60 Ro5Ia7Gi39bgM6Pu9GFeHDqUnlVV+nzYWiCBUVPHEU7vvOvU+BpoD6R+NwaIMF6MjX93Fr gILe4yON+D/C9ANIj9NlakZoaX8/F9nAA2qDi0TXM17ZXY8JhbIEvB1VQ2xtTVvZCzD4Sz NWBuKDn3V8YxABGMokZL/0xb0STvrK7wcr5uN4b9SgPKOu5Ku5TJ6SqYALg/5dMGN+2srE HfExiKzi69MIAfMF1/xc8R2tMhJ33iivQwmwr0a/7VIUyDQbauWR55kCb+Bu4BAdcADWaD hcnCqufNQl3jTspvVX1gL5iWsPWeg4j/KbqDvngbvihKIAFCer5hGuwdPxEisWitjNZ+3s 9ebn7Rv2plpnwnob8P8Z1v/CzGypEdpJGgkgMkAXoUxIZvitFY4LGkailIAZ1pH3Ry5T9E 9hF0oPEDrxSRtqzpeMO7mtIKo425BIrn0sRPpvyCGTR73IhPD/1sa8izhUqjYUIHYIXbIy fyVUeHJ0eesaX13NLA3cZKhDUp7g80FUO1gRfzOPv5HDKdLZPGV2AM8LVGDAeO2/nrB0Ph Efyg1/OlYdlz1358B9trHueaaVF+gfvR2d3hMCH+29d44t12xKM3K75zVC6A X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 3 Dec 2026 08:18:50 -0500 (EST) Received: by mail (OpenSMTPD) with ESMTPSA id 86dde340 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 3 Dec 2026 13:18:15 +0000 (UTC) Date: Thu, 3 Dec 2026 14:18:12 +0100 From: Patrick Steinhardt To: Kaartic Sivaraam Cc: git@vger.kernel.org, Junio C Hamano Subject: Re: [PATCH v2 1/7] commit-graph: verify all trailer hashes against the chain file Message-ID: References: <20261120-pks-odb-pluggable-commit-graphs-v2-0-31f2341a9932@pks.im> <20261120-pks-odb-pluggable-commit-graphs-v2-1-31f2341a9932@pks.im> <7da217b2-f359-4336-8a8a-faf67c4f298f@gmail.com> X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7da217b2-f359-4336-8a8a-faf67c4f298f@gmail.com> On Thu, Dec 03, 2026 at 02:43:42PM +0530, Kaartic Sivaraam wrote: > On 11/20/26 17:52, Patrick Steinhardt wrote: > > > > The fact that we perform the validation when linking means that the > > check of trailer hashes is delayed: we only verify the hash of layer N > > when linking layer N+1 onto it. That of course doesn't make sense, as we > > will then happily use a layer with a mismatching hash while dropping all > > layers built on top of that. What we should do though is to cut the > > commit graph chain at the first mismatching layer. > > > > Furthermore, this also means that we never verify the trailer hash of > > the topmost layer: there is nothing to link onto that layer, and hence > > we never verify it. > > > > Fix this by verifying each layer directly after loading it. > > > > Nit: "verify ... trailer hashes" made me think at first that we now > validate the checksum of each layer on load. On some investigation, I > understand that we don't do that to keep the commit graph load performant. I > wonder if we could phrase that explicitly as follows to make it less > ambiguous: > > Fix this by checking each layer's trailer against the chain file. Sure, can do. > > diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh > > index bf7ba0e5580..aea89f42fa1 100755 > > --- a/t/t5324-split-commit-graph.sh > > +++ b/t/t5324-split-commit-graph.sh > > @@ -275,13 +272,17 @@ corrupt_file() { > > printf "$data" | dd of="$file" bs=1 seek="$pos" conv=notrunc > > } > > -test_expect_success 'verify hashes along chain, even in shallow' ' > > +corrupt_trailer() { > > + corrupt_file "$1" $(($(test_file_size "$1") - 7)) "corrupt" > > +} > > + > > +test_expect_success PERL_TEST_HELPERS 'verify hashes along chain, even in shallow' ' > > Nit: Given the change from testing the base commit rather than the tip > commit with 'verify --shallow', can name this 'verify --shallow detects > corrupt tip layer' ? Makes sense. > > git clone --no-hardlinks . verify && > > ( > > cd verify && > > git commit-graph verify && > > - base_file=$graphdir/graph-$(head -n 1 $graphdir/commit-graph-chain).graph && > > - corrupt_file "$base_file" $(test_oid shallow) "\01" && > > + tip_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph && > > + corrupt_chunk_file "$tip_file" OIDL 0 ff && > > test_must_fail git commit-graph verify --shallow 2>test_err && > > grep -v "^+" test_err >err && > > test_grep "incorrect checksum" err > > Also, the corruption in base layer would still fail in '--shallow' even > after this change. So, is it worth having a test to verify that? Something > like: > > test_expect_success 'verify --shallow notices broken chain below tip' ' > git clone --no-hardlinks . verify-broken-base && > ( > cd verify-broken-base && > base_file=$graphdir/graph-$(head -n 1 > $graphdir/commit-graph-chain).graph && > corrupt_trailer "$base_file" && > test_must_fail git commit-graph verify --shallow 2>err && > test_grep "commit-graph chain does not match" err > ) > ' We already have this test: test_expect_success 'warn on base graph chunk incorrect' ' git clone --no-hardlinks . base-chunk && ( cd base-chunk && git commit-graph verify && base_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph && corrupt_file "$base_file" $(test_oid base) "\01" && test_must_fail git commit-graph verify --shallow 2>test_err && grep -v "^+" test_err >err && test_grep "commit-graph chain does not match" err ) ' So I think that case is covered well enough already. Patrick