Message ID | 20221014084837.1787196-6-hrkanabar@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp71523wrs; Fri, 14 Oct 2022 01:52:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pzDNlM13th0u6dex3yUKZd/iMKzv1hSov8TW6zAUbKpQAfAiY6+DSA/osHqARs3FRw8Gk X-Received: by 2002:a05:6402:40d4:b0:45d:1351:3f9d with SMTP id z20-20020a05640240d400b0045d13513f9dmr2719645edb.199.1665737525371; Fri, 14 Oct 2022 01:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665737525; cv=none; d=google.com; s=arc-20160816; b=boiQFi2LKBMBSHk8C2f5nBQYv1jXkU+ViZkG7DRG447JuUmMiIsHbrTbLqYwoPzvrG XEMUgUwe6GuFvDG/wV75ljagRBdT+Wfy9ZUzs53oKG5fpLLcTImhG/aaCJ71v86kw7yq c8jRK8nLpxLsNfSDmYOkc43GCFLjInNFHCE9ZwW8SzO7MFjDhyDBCYo7n+8XYYQZYemL Wk2lLIVQoALXk3633ubSvdeAu8OOKnWTV5EUpbRcmGuSfwM6lobGBD/Kj71UzEUk/b85 XoQc06uVlmwy4VT8ifY+pbyPHzrTk5thatndA8EOdBnr1NFGKi1f0pK3tnR2Hx1iCcJU 0iSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Gi1PiA14Xvf0/+DfXuVtXD45G5BgebCQf9p57BfhR6s=; b=Itbp5t8gMCKThHlyI0bsakHtE2vSqGIYGQ2BQULQTXMM+f46UTErr3qFRBNmkG0nZp e+6ZyrFSfEkUDwKBwDnGgm3vcMm5OFITLdHOaBESZsO6TgWrM1knupBwtNOiBbx4bRQF Q5W6X8lMSH/zMzbLNqm5vkpIGwbWlARxPdtS7SlRTk6bdCY1suUX5DSjylm39c4v8Blp paznOekfl/HBEP3dwM4TaWrQ1p4tVzi0WWnMyVk5LybMI1ZPmOyw36vJV1eebJgY4Yl+ OAx2a4RiGsEAGH7vhwaVB7ZaXWiwTLnhCNW42LBz4T9n/KQRPZEi0p5b1gJR3TA1xKox VtFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UxT7gVP8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn20-20020a1709070d1400b0078d514ace6bsi2113993ejc.282.2022.10.14.01.51.38; Fri, 14 Oct 2022 01:52:05 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UxT7gVP8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbiJNIuP (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Fri, 14 Oct 2022 04:50:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229922AbiJNIty (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 14 Oct 2022 04:49:54 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 510372793A; Fri, 14 Oct 2022 01:49:52 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id n9so2681111wms.1; Fri, 14 Oct 2022 01:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Gi1PiA14Xvf0/+DfXuVtXD45G5BgebCQf9p57BfhR6s=; b=UxT7gVP8q9ze5Ggh2xvvktN6Ml02oBmfbyNFVTxcbcy6qgnZqVwI+fd54u0LJL+LjK y9EfYIAWCha0O2HVLdo55pAxb/IFOyVB4eHwuuXfLb3Q+WnwPgMtjSKPzu2oQKEhgIW1 8w0WFdRg+RSJnOotAcs1Y+eSeMLVjAcWDFJda2lYZblubtGGGkakV9MIfwsDN7apZ3yC Rg00X0lJRAafbj8ZJHp9DjnqhMJlcm3+NYiLzY/y+FmG8gOcaLVVoEvJhhCVshISMbUn 79bKI/g91GDk/8Ucsg8DPhwD6is+bLLgsNqiPgi18MPBUAdCAjxbT3q7n7tlSgWXhmL1 RzAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gi1PiA14Xvf0/+DfXuVtXD45G5BgebCQf9p57BfhR6s=; b=Ndm+9e02EkIh90achuXSbJ5Oz39gvrY2P+g9PWS0pkPEAZUSDRXxaZvfu68vFJWtvD k4Cqs7CVRog3bv3EkdFXhLdDTyrqzNKbugAC2rVjujcRHo6l1jn7yx3UTuWfpV2WsDyq VmWuW8YMZ57QSM5DYYLqCnjg5EtWPjMAeIDIZLrWdiIayKRAkuxsgz/amZJdREd04Uw7 f4aTyhdWNQVrY74PnXttlnKRfOj7PLareYj0vnpeoNRdUJ6xWhc0MPHQ6H3MOCfsDGGm Cz4AMRPrLGDOfST/JYIqoW3bE5iXXKdefy/vtpJ4h+zQ11uQKjAEadQ90q/94LX4SEBo z23A== X-Gm-Message-State: ACrzQf0fiECU0BIEkYhgWm8MpfiHLZZwOT1HFtoIj+8Mf93VAjBH+N4k WnmgNldrEaELq/nDtoslTr4= X-Received: by 2002:a05:600c:3044:b0:3c4:8af4:ecc5 with SMTP id n4-20020a05600c304400b003c48af4ecc5mr2758757wmh.52.1665737391668; Fri, 14 Oct 2022 01:49:51 -0700 (PDT) Received: from hrutvik.c.googlers.com.com (120.142.205.35.bc.googleusercontent.com. [35.205.142.120]) by smtp.gmail.com with ESMTPSA id 123-20020a1c1981000000b003c6c4639ac6sm1547372wmz.34.2022.10.14.01.49.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 01:49:51 -0700 (PDT) From: Hrutvik Kanabar <hrkanabar@gmail.com> To: Hrutvik Kanabar <hrutvik@google.com> Cc: Marco Elver <elver@google.com>, Aleksandr Nogikh <nogikh@google.com>, kasan-dev@googlegroups.com, Alexander Viro <viro@zeniv.linux.org.uk>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>, Andreas Dilger <adilger.kernel@dilger.ca>, linux-ext4@vger.kernel.org, Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>, David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org, Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>, linux-f2fs-devel@lists.sourceforge.net, "Darrick J . Wong" <djwong@kernel.org>, linux-xfs@vger.kernel.org, Namjae Jeon <linkinjeon@kernel.org>, Sungjong Seo <sj1557.seo@samsung.com>, Anton Altaparmakov <anton@tuxera.com>, linux-ntfs-dev@lists.sourceforge.net Subject: [PATCH RFC 5/7] fs/xfs: support `DISABLE_FS_CSUM_VERIFICATION` config option Date: Fri, 14 Oct 2022 08:48:35 +0000 Message-Id: <20221014084837.1787196-6-hrkanabar@gmail.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221014084837.1787196-1-hrkanabar@gmail.com> References: <20221014084837.1787196-1-hrkanabar@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746652391447047400?= X-GMAIL-MSGID: =?utf-8?q?1746652391447047400?= |
Series |
fs: Debug config option to disable filesystem checksum verification for fuzzing
|
|
Commit Message
Hrutvik Kanabar
Oct. 14, 2022, 8:48 a.m. UTC
From: Hrutvik Kanabar <hrutvik@google.com> When `DISABLE_FS_CSUM_VERIFICATION` is enabled, return truthy value for `xfs_verify_cksum`, which is the key function implementing checksum verification for XFS. Signed-off-by: Hrutvik Kanabar <hrutvik@google.com> --- fs/xfs/libxfs/xfs_cksum.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Comments
On Fri, Oct 14, 2022 at 08:48:35AM +0000, Hrutvik Kanabar wrote: > From: Hrutvik Kanabar <hrutvik@google.com> > > When `DISABLE_FS_CSUM_VERIFICATION` is enabled, return truthy value for > `xfs_verify_cksum`, which is the key function implementing checksum > verification for XFS. > > Signed-off-by: Hrutvik Kanabar <hrutvik@google.com> NAK, we're not going to break XFS for the sake of automated fuzz tools. You'll have to adapt your fuzzing tools to rewrite the block header checksums, like the existing xfs fuzz testing framework does. See the xfs_db 'fuzz -d' command and the relevant fstests. --D > --- > fs/xfs/libxfs/xfs_cksum.h | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fs/xfs/libxfs/xfs_cksum.h b/fs/xfs/libxfs/xfs_cksum.h > index 999a290cfd72..ba55b1afa382 100644 > --- a/fs/xfs/libxfs/xfs_cksum.h > +++ b/fs/xfs/libxfs/xfs_cksum.h > @@ -76,7 +76,10 @@ xfs_verify_cksum(char *buffer, size_t length, unsigned long cksum_offset) > { > uint32_t crc = xfs_start_cksum_safe(buffer, length, cksum_offset); > > - return *(__le32 *)(buffer + cksum_offset) == xfs_end_cksum(crc); > + if (IS_ENABLED(CONFIG_DISABLE_FS_CSUM_VERIFICATION)) > + return 1; > + else > + return *(__le32 *)(buffer + cksum_offset) == xfs_end_cksum(crc); > } > > #endif /* _XFS_CKSUM_H */ > -- > 2.38.0.413.g74048e4d9e-goog >
On Fri, 14 Oct 2022 at 17:44, Darrick J. Wong <djwong@kernel.org> wrote: > > On Fri, Oct 14, 2022 at 08:48:35AM +0000, Hrutvik Kanabar wrote: > > From: Hrutvik Kanabar <hrutvik@google.com> > > > > When `DISABLE_FS_CSUM_VERIFICATION` is enabled, return truthy value for > > `xfs_verify_cksum`, which is the key function implementing checksum > > verification for XFS. > > > > Signed-off-by: Hrutvik Kanabar <hrutvik@google.com> > > NAK, we're not going to break XFS for the sake of automated fuzz tools. Hi Darrick, What do you mean by "break"? If this config is not enabled the behavior is not affected as far as I see. > You'll have to adapt your fuzzing tools to rewrite the block header > checksums, like the existing xfs fuzz testing framework does. See > the xfs_db 'fuzz -d' command and the relevant fstests. > > --D > > > --- > > fs/xfs/libxfs/xfs_cksum.h | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/fs/xfs/libxfs/xfs_cksum.h b/fs/xfs/libxfs/xfs_cksum.h > > index 999a290cfd72..ba55b1afa382 100644 > > --- a/fs/xfs/libxfs/xfs_cksum.h > > +++ b/fs/xfs/libxfs/xfs_cksum.h > > @@ -76,7 +76,10 @@ xfs_verify_cksum(char *buffer, size_t length, unsigned long cksum_offset) > > { > > uint32_t crc = xfs_start_cksum_safe(buffer, length, cksum_offset); > > > > - return *(__le32 *)(buffer + cksum_offset) == xfs_end_cksum(crc); > > + if (IS_ENABLED(CONFIG_DISABLE_FS_CSUM_VERIFICATION)) > > + return 1; > > + else > > + return *(__le32 *)(buffer + cksum_offset) == xfs_end_cksum(crc); > > } > > > > #endif /* _XFS_CKSUM_H */ > > -- > > 2.38.0.413.g74048e4d9e-goog > > > > -- > You received this message because you are subscribed to the Google Groups "kasan-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/Y0mD0LcNvu%2BQTlQ9%40magnolia.
diff --git a/fs/xfs/libxfs/xfs_cksum.h b/fs/xfs/libxfs/xfs_cksum.h index 999a290cfd72..ba55b1afa382 100644 --- a/fs/xfs/libxfs/xfs_cksum.h +++ b/fs/xfs/libxfs/xfs_cksum.h @@ -76,7 +76,10 @@ xfs_verify_cksum(char *buffer, size_t length, unsigned long cksum_offset) { uint32_t crc = xfs_start_cksum_safe(buffer, length, cksum_offset); - return *(__le32 *)(buffer + cksum_offset) == xfs_end_cksum(crc); + if (IS_ENABLED(CONFIG_DISABLE_FS_CSUM_VERIFICATION)) + return 1; + else + return *(__le32 *)(buffer + cksum_offset) == xfs_end_cksum(crc); } #endif /* _XFS_CKSUM_H */