Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4121256rwi; Mon, 17 Oct 2022 01:34:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45Mz7xS6/E358MwTS++PIjZCDi80ix4B4xdT/wMH136kh24mjB4MVxC2Kry/FrDeDVlIsu X-Received: by 2002:a63:318a:0:b0:45a:5d84:3f35 with SMTP id x132-20020a63318a000000b0045a5d843f35mr9762258pgx.394.1665995681608; Mon, 17 Oct 2022 01:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665995681; cv=none; d=google.com; s=arc-20160816; b=wL/8tukNtxAml2Z/utGecLttWwaD6GSgi1QCF+s531Qeesc4YFMEZjl6On1qpfLX1E l2fZNlWz3WJDkF1VI0MAfZ6tkNswoFnlECXZo0qp8NDclSeFsvOWv6rqrwTeHjA2/BlG D3X1yg7Pjqbsw2h5xOJqUNSTrvPORkrz63zBdGqwACEvEUEwT4N13CwbcjiiOSAA/a4E 96XfBfP34Fyh5uVuv4gItk941qHT3hZemISLpOKWM0/1NT5PBDSKLuMSuWTDlFILEAA2 xsjM2zYESsk3WYrHKkmXfrkJ642KemHiV/AX0HTiVT5BBfVfuwYKTBrSqCvx9IF6CVFo K5Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8KsRspEgB/gOfpXeMit48jsmBa9u2K7sMr+wCGZ90pU=; b=fo223uglzZSaRE/JQ/ab8CgjxBwW2HzmGTuxEuh5Nf5t1zKSCR6najXgLWqzKTTl6v epQSfPstp/kKkLCzkQB5g66kjeW4Aw9wSu3VbxEMFmwSFGjRNkjdfQ5dAs8S6pHKtEzc +3GDboajK64WLKY1jf6gan0o2G0Q098EJXlkwu8R+mytqfw1zfg6gcBv7C4kFlZhqBmi B2iZv+uxEMFUe8LYFmD2+NO52y/Jcwu4c/C2ya0WDR4C0LNHnavn4dSNNhl1HQr+GwIo nEPp7eqT4Bekgout8rtjDSMOVr2bNozVjWMFM5vrlmAURtqd3PrFe3s+jve/zkL4vlPn 3zrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=iXrGdd8C; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h17-20020a17090ac39100b0020d43be11b1si10842291pjt.131.2022.10.17.01.34.23; Mon, 17 Oct 2022 01:34:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=@google.com header.s=20210112 header.b=iXrGdd8C; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230170AbiJQIbW (ORCPT + 99 others); Mon, 17 Oct 2022 04:31:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230206AbiJQIbU (ORCPT ); Mon, 17 Oct 2022 04:31:20 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78B54209A7 for ; Mon, 17 Oct 2022 01:31:17 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id b2so16373742lfp.6 for ; Mon, 17 Oct 2022 01:31:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8KsRspEgB/gOfpXeMit48jsmBa9u2K7sMr+wCGZ90pU=; b=iXrGdd8Ce/D/Ym1P/AKmDjhkCRodIz0sVHqhCXCbzz/70S2w/xiwhFMs2ZE6LzAOaY kerpA8DKLp8h2EYJv/OamQ96cNwCdVwhlMsEt2I/Fx1TXldfIxx8y8EdnjfTih1j5QQY mcontV8hQeGs5ML1x0iwjYx4oVH0ravWrBbKL8nhqpsejuYizWkrN/Z0xocIgE9V/nqA /ibMQ5BBiN6XVdPz/bWMDfcoSg3yAyVOTjHlVwPDjsYICQVyEKqxZha6l63hzWMq89fQ ikDz03AXZbI54WZYRpIVuo0JGyUqwrFqZ1lSI9F+0vgKA6aqXG/1CN3roD6DwyasNLJq 0f1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8KsRspEgB/gOfpXeMit48jsmBa9u2K7sMr+wCGZ90pU=; b=7V8TGojveKttaJgbPtevsSYQh/5GSLAFnfCnZWIwXt9OrGWMqU8o9+eBltL33k5Tlx zOJwhr7nPfuooptGzCT4qy8TJhfoxr6SSvGgGRPEFWcirYEWH4br3AB8M6c5T0iRg8J5 jP/u/ILNH/wL9Zd/gY9IfbuH145GzsWV9p0OeqU//mZzOp1sBWoBDlDi4N4PZnLT7F/t AB4zLEONzdwx//8Lhh5FEBRH3ytiVehlbwmDGidaxagEVd5u1JYNjUrgaB8b4EIubL4t QN+HK0RZ0fg1v0kI/enz84SCYRv/vfZU2UyC2iQ7q+wqif9Hwtxt1wPe7hGSqwnPrviB e/9Q== X-Gm-Message-State: ACrzQf1/XDG7y3Yg17xBjR45vXELmHW6pd/ChnB4g5MtaV3Zkqep6Cq1 0lpm04lSlCtilhTpylTsiLmAElIRYl5E9zRuIqgQxw== X-Received: by 2002:a05:6512:358c:b0:4a2:9c55:c63c with SMTP id m12-20020a056512358c00b004a29c55c63cmr3765865lfr.598.1665995475449; Mon, 17 Oct 2022 01:31:15 -0700 (PDT) MIME-Version: 1.0 References: <20221014084837.1787196-1-hrkanabar@gmail.com> <20221014091503.GA13389@twin.jikos.cz> In-Reply-To: <20221014091503.GA13389@twin.jikos.cz> From: Dmitry Vyukov Date: Mon, 17 Oct 2022 10:31:03 +0200 Message-ID: Subject: Re: [PATCH RFC 0/7] fs: Debug config option to disable filesystem checksum verification for fuzzing To: dsterba@suse.cz Cc: Hrutvik Kanabar , Hrutvik Kanabar , Marco Elver , Aleksandr Nogikh , kasan-dev@googlegroups.com, Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, "Theodore Ts'o" , Andreas Dilger , linux-ext4@vger.kernel.org, Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Namjae Jeon , Sungjong Seo , Anton Altaparmakov , linux-ntfs-dev@lists.sourceforge.net Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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-ext4@vger.kernel.org On Fri, 14 Oct 2022 at 11:15, David Sterba wrote: > > On Fri, Oct 14, 2022 at 08:48:30AM +0000, Hrutvik Kanabar wrote: > > From: Hrutvik Kanabar > > > > Fuzzing is a proven technique to discover exploitable bugs in the Linux > > kernel. But fuzzing filesystems is tricky: highly structured disk images > > use redundant checksums to verify data integrity. Therefore, > > randomly-mutated images are quickly rejected as corrupt, testing only > > error-handling code effectively. > > > > The Janus [1] and Hydra [2] projects probe filesystem code deeply by > > correcting checksums after mutation. But their ad-hoc > > checksum-correcting code supports only a few filesystems, and it is > > difficult to support new ones - requiring significant duplication of > > filesystem logic which must also be kept in sync with upstream changes. > > Corrected checksums cannot be guaranteed to be valid, and reusing this > > code across different fuzzing frameworks is non-trivial. > > > > Instead, this RFC suggests a config option: > > `DISABLE_FS_CSUM_VERIFICATION`. When it is enabled, all filesystems > > should bypass redundant checksum verification, proceeding as if > > checksums are valid. Setting of checksums should be unaffected. Mutated > > images will no longer be rejected due to invalid checksums, allowing > > testing of deeper code paths. Though some filesystems implement their > > own flags to disable some checksums, this option should instead disable > > all checksums for all filesystems uniformly. Critically, any bugs found > > remain reproducible on production systems: redundant checksums in > > mutated images can be fixed up to satisfy verification. > > > > The patches below suggest a potential implementation for a few > > filesystems, though we may have missed some checksums. The option > > requires `DEBUG_KERNEL` and is not intended for production systems. > > > > The first user of the option would be syzbot. We ran preliminary local > > syzkaller tests to compare behaviour with and without these patches. > > With the patches, we found a 19% increase in coverage, as well as many > > new crash types and increases in the total number of crashes: > > I think the build-time option inflexible, but I see the point when > you're testing several filesystems that it's one place to set up the > environment. Alternatively I suggest to add sysfs knob available in > debuging builds to enable/disable checksum verification per filesystem. Hi David, What usage scenarios do you have in mind for runtime changing of this option? I see this option intended only for very narrow use cases which require a specially built kernel in a number of other ways (lots of which are not tunable at runtime, e.g. debugging configs). > As this may not fit to other filesystems I don't suggest to do that for > all but I am willing to do that for btrfs, with eventual extension to > the config option you propose. The increased fuzzing coverage would be > good to have.