From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 1F20DD804D6 for ; Sun, 3 Dec 2023 22:56:06 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=lwsidV62TCpqWwklzoXJV81f+zLLrHk3qOko0UG4coo=; c=relaxed/simple; d=groups.io; h=From:Mime-Version:Subject:Date:Message-Id:References:Cc:In-Reply-To:To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1701644165; v=1; b=dzASS1cexGSRfVPDY6nnVji0lmedM0BImAqBLitQkRpmZSV73qm91OnW8jgeAJmrXK051irI QFpWr7liL1jHrEvrYhp2sDP7d3n4lcK1QAuteLwC2RxOFssDQs4+WlknmIWbkFEr0lrl4ZpC016 9ILvDgY70muiUzbaOMYpTtSY= X-Received: by 127.0.0.2 with SMTP id anjdYY7687511xDDWH7H6har; Sun, 03 Dec 2023 14:56:05 -0800 X-Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by mx.groups.io with SMTP id smtpd.web10.51073.1701644164094777300 for ; Sun, 03 Dec 2023 14:56:04 -0800 X-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 434FA240104 for ; Sun, 3 Dec 2023 23:56:02 +0100 (CET) X-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Sk2G91DVRz6txs; Sun, 3 Dec 2023 23:56:01 +0100 (CET) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= Mime-Version: 1.0 (1.0) Subject: Re: [edk2-devel] [PATCH] Ext4Pkg: Fix CRC16 checksumming on block groups Date: Sun, 3 Dec 2023 22:55:50 +0000 Message-Id: <5663FBC1-80BD-4264-AE8E-B8A35EFF6495@posteo.de> References: <20231203224059.23277-1-pedro.falcato@gmail.com> Cc: devel@edk2.groups.io, Savva Mitrofanov In-Reply-To: <20231203224059.23277-1-pedro.falcato@gmail.com> To: Pedro Falcato Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mhaeuser@posteo.de List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: tbXeuPlb6zFxoZ1cp3XiT2uQx7686176AA= Content-Type: multipart/signed; boundary=Apple-Mail-8EF004CA-F460-479E-A67F-8C5AF2D03B77; protocol="application/pkcs7-signature"; micalg=sha-256 Content-Transfer-Encoding: 7bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=dzASS1ce; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (strict), DKIM not aligned (strict)" header.from=posteo.de (policy=none) --Apple-Mail-8EF004CA-F460-479E-A67F-8C5AF2D03B77 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Reviewed-by: Marvin H=C3=A4user > On Dec 3, 2023, at 23:41, Pedro Falcato wrote: >=20 > =EF=BB=BFOld filesystems (around 2008 and older) do not use CRC32c > but rather CRC16-ANSI. Previously, the CalculateCrc16Ansi function was > broken and gave us wrong checksums. Adapt to the new interface. >=20 > And while we're at it, fix the checksum algorithm itself - the crc16 > algorithm just skips over the bg_checksum, and does not checksum it. >=20 > This problem was found out-of-list when older ext4 filesystems > (that use crc16 checksums) failed to mount with "corruption". >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4609 > Signed-off-by: Pedro Falcato > Cc: Savva Mitrofanov > Cc: Marvin H=C3=A4user > --- > Features/Ext4Pkg/Ext4Dxe/BlockGroup.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) >=20 > diff --git a/Features/Ext4Pkg/Ext4Dxe/BlockGroup.c b/Features/Ext4Pkg/Ext= 4Dxe/BlockGroup.c > index f34cdc5dbad7..d5642a5f155c 100644 > --- a/Features/Ext4Pkg/Ext4Dxe/BlockGroup.c > +++ b/Features/Ext4Pkg/Ext4Dxe/BlockGroup.c > @@ -169,14 +169,10 @@ Ext4CalculateBlockGroupDescChecksumGdtCsum ( > ) > { > UINT16 Csum; > - UINT16 Dummy; >=20 > - Dummy =3D 0; > - > - Csum =3D CalculateCrc16Ansi (Partition->SuperBlock.s_uuid, 16, 0); > + Csum =3D CalculateCrc16Ansi (Partition->SuperBlock.s_uuid, 16, CRC16AN= SI_INIT); > Csum =3D CalculateCrc16Ansi (&BlockGroupNum, sizeof (BlockGroupNum), Cs= um); > Csum =3D CalculateCrc16Ansi (BlockGroupDesc, OFFSET_OF (EXT4_BLOCK_GROU= P_DESC, bg_checksum), Csum); > - Csum =3D CalculateCrc16Ansi (&Dummy, sizeof (Dummy), Csum); > Csum =3D > CalculateCrc16Ansi ( > &BlockGroupDesc->bg_block_bitmap_hi, > -- > 2.43.0 >=20 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111998): https://edk2.groups.io/g/devel/message/111998 Mute This Topic: https://groups.io/mt/102960519/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --Apple-Mail-8EF004CA-F460-479E-A67F-8C5AF2D03B77 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCCBa8w ggWrMIIDk6ADAgECAhA9P4A/jnLYWuD7Jx/CcP6cMA0GCSqGSIb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