Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2006551rwp; Thu, 13 Jul 2023 22:09:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlE00/TzOVPV2egvRTNb7EFxMfxzZbKYDKnuhOrW2wMDwofbNVGhi9PuDXS4LCNOB/R5Lk5S X-Received: by 2002:a05:6358:9044:b0:134:c552:522e with SMTP id f4-20020a056358904400b00134c552522emr1707340rwf.24.1689311375693; Thu, 13 Jul 2023 22:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689311375; cv=none; d=google.com; s=arc-20160816; b=tqo8b2ZmYMAZp7Vc6AE7nrEJCWyyFgLJQBiU+tyxeBrUb+3D6meqzgowB5zvYArL4j tyUGMiR3I2/Npdd+bRTg3VOEAy2rMrjbVNGmsQx2FXKHpT3z539mlRWDCen1NLmx3/Bm 6n4G2MnP6RKx2J/B+ha8NYX2ns5DwRYHLVMnzBeISaoCKSw794IRc6JzslB0DfzjlQXR HMVgBx7rjPAY3cWBQAqCwNnHklfKT7aRqttHNluvPf7MnS8ZGcnb1nSnZMzDyqT6LdPI QvuhQ9B+7D/hSpr05gmo56AQ0UafgrbcJ57awyQijJhOwjeJalXDfoeQGmkysSQBnTHq OTlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=drfZelL+3Zt/Tjf1Z4Ld+vpJ6zDzX8cTkG72CE8PRAg=; fh=cnJt6haEv7+bsjODVltNiAI4Q3L5qahcKF0hz6AyO3A=; b=ye4R86kQdiAqG9TNAOx41mpDIebI1xsRZz3kq5puPOB7X3jJUlG/PVSxfpdr9MAqW3 NMXIc1wnj5eJmFx8pc8av3O2qSiGHm8Rztgk7XZeF0Ybdtj+gR6nHUHgVoRHEgDFWYU7 lKYZPh7gX/WIIong4hzRALb3LV41qp81oHB9Lwe4pPc4JyeElW0n7+XVXa9lRUXrNJoy 9jQMY4sPTIGqfzACNokr5iORRQ6mo2crLulLRxoxfcwiPNnTyGKgMKWVhbaGJUGeGrvP vfWeX31u1YwF6RMbMPLh2ps6nm1qZ2CB8X2wfSJhozKafelFBppj1XIDkbDRXHy9Zllj phgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 32-20020a631360000000b0051b9ce24708si6344542pgt.103.2023.07.13.22.09.22; Thu, 13 Jul 2023 22:09:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234693AbjGNE3o (ORCPT + 99 others); Fri, 14 Jul 2023 00:29:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232372AbjGNE3m (ORCPT ); Fri, 14 Jul 2023 00:29:42 -0400 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67FE62736 for ; Thu, 13 Jul 2023 21:29:40 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R591e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VnKDHcR_1689308975; Received: from 30.97.49.6(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VnKDHcR_1689308975) by smtp.aliyun-inc.com; Fri, 14 Jul 2023 12:29:36 +0800 Message-ID: <8a896983-ec76-d705-b4af-b34ffe529a81@linux.alibaba.com> Date: Fri, 14 Jul 2023 12:29:35 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] erofs: deprecate superblock checksum feature To: Jingbo Xu , chao@kernel.org, huyue2@coolpad.com, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, pratikshinde320@gmail.com References: <20230714033832.111740-1-jefflexu@linux.alibaba.com> From: Gao Xiang In-Reply-To: <20230714033832.111740-1-jefflexu@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/7/14 11:38, Jingbo Xu wrote: > Later we're going to introduce fs-verity based verification for the > whole image. Make the superblock checksum feature deprecated. I'd suggest that "Later we're going to try the self-contained image verification. The current superblock checksum feature has quite limited functionality, instead, merkle trees can provide better protection for image integrity. Since the superblock checksum is a compatible feature, just deprecate now. " > > Signed-off-by: Jingbo Xu > --- > fs/erofs/Kconfig | 1 - > fs/erofs/super.c | 44 +++++--------------------------------------- > 2 files changed, 5 insertions(+), 40 deletions(-) > > diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig > index f259d92c9720..ebcb1f6a426a 100644 > --- a/fs/erofs/Kconfig > +++ b/fs/erofs/Kconfig > @@ -4,7 +4,6 @@ config EROFS_FS > tristate "EROFS filesystem support" > depends on BLOCK > select FS_IOMAP > - select LIBCRC32C > help > EROFS (Enhanced Read-Only File System) is a lightweight read-only > file system with modern designs (e.g. no buffer heads, inline > diff --git a/fs/erofs/super.c b/fs/erofs/super.c > index 9d6a3c6158bd..bb6a966ac4d4 100644 > --- a/fs/erofs/super.c > +++ b/fs/erofs/super.c > @@ -8,7 +8,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -51,33 +50,6 @@ void _erofs_info(struct super_block *sb, const char *function, > va_end(args); > } > > -static int erofs_superblock_csum_verify(struct super_block *sb, void *sbdata) > -{ > - size_t len = 1 << EROFS_SB(sb)->blkszbits; > - struct erofs_super_block *dsb; > - u32 expected_crc, crc; > - > - if (len > EROFS_SUPER_OFFSET) > - len -= EROFS_SUPER_OFFSET; > - > - dsb = kmemdup(sbdata + EROFS_SUPER_OFFSET, len, GFP_KERNEL); > - if (!dsb) > - return -ENOMEM; > - > - expected_crc = le32_to_cpu(dsb->checksum); > - dsb->checksum = 0; > - /* to allow for x86 boot sectors and other oddities. */ > - crc = crc32c(~0, dsb, len); > - kfree(dsb); > - > - if (crc != expected_crc) { > - erofs_err(sb, "invalid checksum 0x%08x, 0x%08x expected", > - crc, expected_crc); > - return -EBADMSG; > - } > - return 0; > -} > - > static void erofs_inode_init_once(void *ptr) > { > struct erofs_inode *vi = ptr; > @@ -113,15 +85,16 @@ static void erofs_free_inode(struct inode *inode) > static bool check_layout_compatibility(struct super_block *sb, > struct erofs_super_block *dsb) > { > - const unsigned int feature = le32_to_cpu(dsb->feature_incompat); > + struct erofs_sb_info *sbi = EROFS_SB(sb); > > - EROFS_SB(sb)->feature_incompat = feature; > + sbi->feature_compat = le32_to_cpu(dsb->feature_compat); > + sbi->feature_incompat = le32_to_cpu(dsb->feature_incompat); > > /* check if current kernel meets all mandatory requirements */ > - if (feature & (~EROFS_ALL_FEATURE_INCOMPAT)) { > + if (sbi->feature_incompat & (~EROFS_ALL_FEATURE_INCOMPAT)) { > erofs_err(sb, > "unidentified incompatible feature %x, please upgrade kernel version", > - feature & ~EROFS_ALL_FEATURE_INCOMPAT); > + sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT); > return false; > } > return true; > @@ -365,13 +338,6 @@ static int erofs_read_superblock(struct super_block *sb) > goto out; > } > > - sbi->feature_compat = le32_to_cpu(dsb->feature_compat); > - if (erofs_sb_has_sb_chksum(sbi)) { > - ret = erofs_superblock_csum_verify(sb, data); > - if (ret) > - goto out; > - } > - > ret = -EINVAL; > if (!check_layout_compatibility(sb, dsb)) > goto out;