From patchwork Fri Dec 30 22:19:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085209 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1966C4332F for ; Sat, 31 Dec 2022 00:44:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235883AbiLaAo1 (ORCPT ); Fri, 30 Dec 2022 19:44:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235879AbiLaAo0 (ORCPT ); Fri, 30 Dec 2022 19:44:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFD7A1DDE5; Fri, 30 Dec 2022 16:44:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B09E8B81E6C; Sat, 31 Dec 2022 00:44:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B2BFC433D2; Sat, 31 Dec 2022 00:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447463; bh=ui3KL/Lisnrr9lErSTK+rHBwJ7KmXJI3hC3hvAQcqyc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=sLJKzlBG9kL+xJCvGd4P4rj6t4njRFu81rkCY5oEIPGnMGhbPyAlIje2Mw1MJ0mXV GGChYpfMF5uiQHPuvoaiz4n8XmQcTviuUlA7Nv+uN4wrQL1EQgX5PwyL4ut/haAb0j yDAg+Qjb+T3VaWohJp46Z1U30Up0Mt6XmbKpHgLh30Ugc0695BC7BGGiBTFQPsQ/Ge 2wxAEs8eI61Jz4oxd0/u1XH+3E+f8Mk1qZULp7J2FowIPT+snJW/z0DSYXJBVBeY88 RbiDsNn1MC5hOKJJgQiX9sUlqO111///B1qrRVym8j9hgqbF7dMANc5IAAe52SJLVD Vwam/4qb+u9oQ== Subject: [PATCH 01/24] fuzzy: disable per-field random fuzzing by default From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:39 -0800 Message-ID: <167243877920.730387.3533277209166689155.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Don't run the random fuzzer by default so that we can try to stabilize the output somewhat. Signed-off-by: Darrick J. Wong --- common/fuzzy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/fuzzy b/common/fuzzy index d4177c3136..cd6e2a0e08 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -284,7 +284,8 @@ _scratch_xfs_list_fuzz_verbs() { return; fi _scratch_xfs_db -x -c 'sb 0' -c 'fuzz' | grep '^Fuzz commands:' | \ - sed -e 's/[,.]//g' -e 's/Fuzz commands: //g' -e 's/ /\n/g' + sed -e 's/[,.]//g' -e 's/Fuzz commands: //g' -e 's/ /\n/g' | \ + grep -v '^random$' } # Fuzz some of the fields of some piece of metadata From patchwork Fri Dec 30 22:19:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085210 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97D00C4332F for ; Sat, 31 Dec 2022 00:44:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235901AbiLaAop (ORCPT ); Fri, 30 Dec 2022 19:44:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235923AbiLaAon (ORCPT ); Fri, 30 Dec 2022 19:44:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36D751EAC9; Fri, 30 Dec 2022 16:44:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 39311B81E79; Sat, 31 Dec 2022 00:44:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F25B6C433D2; Sat, 31 Dec 2022 00:44:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447479; bh=lMyQa2uCBpJA0FdLpONrAsSONhKH7rdyHnsWrlcBaaI=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=JAK60yl6fBbE9hG8Wi18aH21bQbimHUd1u/3ww11jgpOUFGCPmNNgLBhqABhiyY88 M9eSKK9RgHmkGXuPfjVyr2SBmcgOitF1+In/roqFXpszzkJobdqvM8nJunmcO+3O6f knamz21EQ2vqWSFV99KdZzAjguDq87IkdtoRNPhGJkABhr1LLvO9iXU2FbONFkzJT3 F6yi5P5feqbGlTxFP/T1Wn72yKQvIoECRevM/+TEExnhdjWcdhbMZXxD4huwk4UBYM stDA5ZneKwNaz/MRm4OH9MhKGIObo6sS3R+ymnvcP9rIBdnwy900tW7QYsO/N414HW yJc/IFMA0m2Fg== Subject: [PATCH 02/24] fuzzy: disable timstamp fuzzing by default From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:39 -0800 Message-ID: <167243877933.730387.11688188649202773886.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Don't fuzz timestamps since all bit patterns are valid and XFS itself does not perform any validation on them. Signed-off-by: Darrick J. Wong --- common/fuzzy | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/fuzzy b/common/fuzzy index cd6e2a0e08..2798c257a0 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -73,6 +73,14 @@ __filter_xfs_db_keys() { -e '/pad/d' } +# Filter out metadata fields that are completely controlled by userspace +# or are arbitrary bit sequences. In other words, fields where the filesystem +# does no validation. +__filter_unvalidated_xfs_db_fields() { + sed -e '/\.sec/d' \ + -e '/\.nsec/d' +} + # Filter the xfs_db print command's field debug information # into field name and type. __filter_xfs_db_print_fields() { @@ -91,7 +99,7 @@ __filter_xfs_db_print_fields() { else echo "${fuzzkey}" fi - done | grep -E "${filter}" + done | grep -E "${filter}" | __filter_unvalidated_xfs_db_fields } # Navigate to some part of the filesystem and print the field info. From patchwork Fri Dec 30 22:19:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085211 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31532C4332F for ; Sat, 31 Dec 2022 00:44:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235879AbiLaAo4 (ORCPT ); Fri, 30 Dec 2022 19:44:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235868AbiLaAo4 (ORCPT ); Fri, 30 Dec 2022 19:44:56 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 845E81D0C8; Fri, 30 Dec 2022 16:44:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2423261D5E; Sat, 31 Dec 2022 00:44:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81AADC433D2; Sat, 31 Dec 2022 00:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447494; bh=lg6Kci8gAYkjBnA4jWbeTc6udRQF7YkXDDDl0IBixn4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=dxtddWgr78MINX3uZmdN2ku7yb0xAS6HSsI1Jp0uPA+ddod75YMepiVGGSvfXcFw8 P9iiDZA2L4JmIZQ+58axvmm0cNFBJyyqTOBwNAFJkvElWxiloEd50w56MahGoYAMtj Ew8Ut6gNBebFxJQ0iPUmFIg6Wp3Tf5KYUBMxD/tQdLfw3/qILatdFZ92SgulJkARmO /VU0iDA/9Y5e3mBpT8sf9GnMqhfbvGN2mXU52jNNn3yJKUCDeIKoYzwxW/oH8AL2iq HkgcNY1Y1nHWxQbk4V6IfZ9TJnUc6gTzHvbbGjmG5/B/Nl2/a2RHDhSYpbIj+l7BRx 89OZELs6m7kNA== Subject: [PATCH 03/24] fuzzy: don't fuzz the log sequence number From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:39 -0800 Message-ID: <167243877946.730387.8683116177682310024.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Don't bother filtering log sequence numbers since xfs_db doesn't have the ability to tell us the range of LSNs that would actually cause validation failures. Signed-off-by: Darrick J. Wong --- common/fuzzy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/fuzzy b/common/fuzzy index 2798c257a0..677e655d68 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -78,7 +78,9 @@ __filter_xfs_db_keys() { # does no validation. __filter_unvalidated_xfs_db_fields() { sed -e '/\.sec/d' \ - -e '/\.nsec/d' + -e '/\.nsec/d' \ + -e '/^lsn$/d' \ + -e '/\.lsn/d' } # Filter the xfs_db print command's field debug information From patchwork Fri Dec 30 22:19:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085212 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2977EC4332F for ; Sat, 31 Dec 2022 00:45:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235885AbiLaApN (ORCPT ); Fri, 30 Dec 2022 19:45:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235868AbiLaApN (ORCPT ); Fri, 30 Dec 2022 19:45:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A54ED1EAD1; Fri, 30 Dec 2022 16:45:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A7C2B81E67; Sat, 31 Dec 2022 00:45:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17597C433D2; Sat, 31 Dec 2022 00:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447510; bh=ZAzs2xev1tfa8EyQhXzzWBBAFojFFl6uRQi+nzTBvp8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Mc+jU5ovYdBVWyHKoObFuZmYUJXYJ0tuft28UEf05P1BLOOJFHGbAZo5nFxvvaj+w 1kecPkHpS1H7goxMa8OVoXzCna5SC0+lPpD8sk9nE5CAxwMRU3hkPrfHTIzNs7u57C ZVrZNMfgKLYnVR3tni0GBydbieQu+9hL7gEH4pk1eunq5fPxqhEEwazGGDJ0RwFWvW SHw6NVc1L1aTEkm2EpRhwLDbwG6opxS7Wx5f++y4PJtUNVivjrijdG2mW9T40/e6wx +cHjoA8a08T+JYU1A9OuH1z5PeUYOd0bpeimYafbZkm2LJ85c3r2lhtMWddUSXJcdA LhICBJynL2Lkg== Subject: [PATCH 04/24] fuzzy: don't fuzz obsolete inode fields From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:39 -0800 Message-ID: <167243877960.730387.18399629813029803190.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong We don't really care about inode fields were used in V4 (deprecated) or DMAPI (unsupported) so don't bother fuzzing them. Signed-off-by: Darrick J. Wong --- common/fuzzy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/fuzzy b/common/fuzzy index 677e655d68..d183052a14 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -80,7 +80,10 @@ __filter_unvalidated_xfs_db_fields() { sed -e '/\.sec/d' \ -e '/\.nsec/d' \ -e '/^lsn$/d' \ - -e '/\.lsn/d' + -e '/\.lsn/d' \ + -e '/^core.flushiter/d' \ + -e '/^core.dmevmask/d' \ + -e '/^core.dmstate/d' } # Filter the xfs_db print command's field debug information From patchwork Fri Dec 30 22:19:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085213 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB01DC3DA7D for ; Sat, 31 Dec 2022 00:45:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235868AbiLaApa (ORCPT ); Fri, 30 Dec 2022 19:45:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235897AbiLaAp1 (ORCPT ); Fri, 30 Dec 2022 19:45:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98ECE1D0C8; Fri, 30 Dec 2022 16:45:26 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3815A61D60; Sat, 31 Dec 2022 00:45:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9600AC433EF; Sat, 31 Dec 2022 00:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447525; bh=3x3XEDRXMs+IWlpWKgflc3vUvWTqgKOotEG36aBKnGM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=m9H4wZznkdSBgIMT8Y9lkCArvg4jW3ziaMfwaNQ9QeJ8kF0dWEqVUJhOauSsjrfS/ 5AKvn4KqbHdy+clTvoa4OePYDXyn1nqvKiETwy9sUA5iZu/H+nRT2azs+BypqWjRuA miRVJagG8QWnsNtrCjH67Gem2XPTifUQ5U5CEO47K0w4iUK+pxQjO1blkT5s5LJtEb qtVXg7ClMzPlraCOafHSmjU9AVd9R7Bx5YmcMvovypuicN2v3+mE+q+Y5UR3DL2AqS lxA7hIj+lUX8gYHGC/VjTyUH7c3NZNTPpaJPqFH2GC+fAGTJxNXb2Yl3L7MsJPwbGi Jh+NbdgRJPXQA== Subject: [PATCH 05/24] fuzzy: don't fuzz inode generation numbers From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:39 -0800 Message-ID: <167243877973.730387.11174533211065383401.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong The inode generation number is a randomly selected 32-bit integer that isn't itself validated anywhere. No need to fuzz that. Signed-off-by: Darrick J. Wong --- common/fuzzy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/fuzzy b/common/fuzzy index d183052a14..0d7e60a011 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -83,7 +83,8 @@ __filter_unvalidated_xfs_db_fields() { -e '/\.lsn/d' \ -e '/^core.flushiter/d' \ -e '/^core.dmevmask/d' \ - -e '/^core.dmstate/d' + -e '/^core.dmstate/d' \ + -e '/^core.gen/d' } # Filter the xfs_db print command's field debug information From patchwork Fri Dec 30 22:19:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085214 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B939FC4332F for ; Sat, 31 Dec 2022 00:45:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235942AbiLaApr (ORCPT ); Fri, 30 Dec 2022 19:45:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235943AbiLaApo (ORCPT ); Fri, 30 Dec 2022 19:45:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0A5EB9C; Fri, 30 Dec 2022 16:45:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 92F67B81E6C; Sat, 31 Dec 2022 00:45:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39BB9C433EF; Sat, 31 Dec 2022 00:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447541; bh=8FbULoN8kBXZHkVgmJabgBicREZdwJSjrlqSu6tx9Rc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=uk/VEV6j9baXvNj0G3zUP6K3MIBOLzwTtRoIvVl8QnoBN7QPsK6VEcl3lLDQBTu8Q tr1RXJRADdviwkk+UJT4pqLxyeJNcGDzUinPsvCFUODgjXSI0jqczPyg6uEk+haejn yUs2DUO+IEc/cQdo7W7xOaNfAsP3Vrf7NvrNJPd7I0ogBtVU9qTLnAUG6G5eLP/O1m ty/KLMaOzUe6lqBuvCtWNrwDG5Qa2w4tYZmiMul1HMnRJGNKIYaabf/J+sAShd4l7i x0qGKtpQeNNutYhPTiMWWF5fYcanmcnXuv0L204Uu/UZ7/hQSQZ4C94vyBG4pRtxrZ Olhm01JFe6pwg== Subject: [PATCH 06/24] fuzzy: don't fuzz user-controllable inode flags From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:39 -0800 Message-ID: <167243877984.730387.14992965943174698029.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Don't fuzz the inode flags that are controlled by userspace and don't actually have any other effects on the ondisk metadata. Signed-off-by: Darrick J. Wong --- common/fuzzy | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/fuzzy b/common/fuzzy index 0d7e60a011..6f5083041a 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -84,7 +84,15 @@ __filter_unvalidated_xfs_db_fields() { -e '/^core.flushiter/d' \ -e '/^core.dmevmask/d' \ -e '/^core.dmstate/d' \ - -e '/^core.gen/d' + -e '/^core.gen/d' \ + -e '/^core.prealloc/d' \ + -e '/^core.immutable/d' \ + -e '/^core.append/d' \ + -e '/^core.sync/d' \ + -e '/^core.noatime/d' \ + -e '/^core.nodump/d' \ + -e '/^core.nodefrag/d' \ + -e '/^v3.dax/d' } # Filter the xfs_db print command's field debug information From patchwork Fri Dec 30 22:19:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085236 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA784C4332F for ; Sat, 31 Dec 2022 00:46:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235930AbiLaAqA (ORCPT ); Fri, 30 Dec 2022 19:46:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235927AbiLaAqA (ORCPT ); Fri, 30 Dec 2022 19:46:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FFCDB9C; Fri, 30 Dec 2022 16:45:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2D6A0B81D68; Sat, 31 Dec 2022 00:45:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8CE0C433D2; Sat, 31 Dec 2022 00:45:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447556; bh=O8ylGs9dvytA68wL2FE9ofweoWLYgVt7Mpcyx7HqrM0=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=HIbuQOj1flYh3h9eFlbkDd7pM5NkYW/iv8sUON2z3GkApcsEOP1hSUNWXusoYJ6F1 A/IBrhMZaYs75qFp6yY77jVxVgmy1+3ZlW50v10I0jxusQYU2kp6beft7zaA/OBik4 Wf0dM5gjCCyrbkfar4CvgxPalzHM+Z+424gR3Nk2MmVemdEz+fAGwJ13bf5ckS92g4 KKmiQtCk+OMr8vINOSOH0kHcsv1AbvsaiSAt92IQSWmF67OYsCsO81RxYa1/EpOKH5 qiuM0Svh2kfovUirZ8cNQ9WSwX5TasJTt5zNtGEzb46Amjlqt+tLqMS/5cZHcAUJ79 BjlxYm7/q1BxQ== Subject: [PATCH 07/24] fuzzy: don't fuzz xattr namespace flags and values From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:39 -0800 Message-ID: <167243877996.730387.15482162605984984086.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Extended attribute namespace flags are controlled by userspace, and there is no validation imposed on the values. Don't bother fuzzing either of these things. Signed-off-by: Darrick J. Wong --- common/fuzzy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/fuzzy b/common/fuzzy index 6f5083041a..866901931e 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -92,7 +92,13 @@ __filter_unvalidated_xfs_db_fields() { -e '/^core.noatime/d' \ -e '/^core.nodump/d' \ -e '/^core.nodefrag/d' \ - -e '/^v3.dax/d' + -e '/^v3.dax/d' \ + -e '/^nvlist.*value/d' \ + -e '/^entries.*root/d' \ + -e '/^entries.*secure/d' \ + -e '/^a.sfattr.list.*value/d' \ + -e '/^a.sfattr.list.*root/d' \ + -e '/^a.sfattr.list.*secure/d' } # Filter the xfs_db print command's field debug information From patchwork Fri Dec 30 22:19:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085237 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2D8FC3DA7C for ; Sat, 31 Dec 2022 00:46:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235935AbiLaAqP (ORCPT ); Fri, 30 Dec 2022 19:46:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235927AbiLaAqO (ORCPT ); Fri, 30 Dec 2022 19:46:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7447C55BF; Fri, 30 Dec 2022 16:46:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0EEE161D63; Sat, 31 Dec 2022 00:46:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51072C433D2; Sat, 31 Dec 2022 00:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447572; bh=dEhlWmbmnxjiW8QH6B/a9Yb8GMBvcJ3lCezcSuOQFHo=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=XK4TsgYhFYJIsAayQkr0E+UqmZzGKpA6GOVcU3t2uc/8ylJdQBKdaPlNKuSV7TK5B RHSLXHZfll0c/XjqVNelPKks1PYd7Gtg2G8Ue8Ip4yfgpdIMJRjE6HvVrl4Gc7KQJJ GBeuh4C1DaCJey3yVgqydNJ5xkKVlTQgi93vVRO8QLOJiBXhqLCb78sC3zKqbXfeZM 4OwbB1O9aWdTCLred8+UqU7TPfqrxQ3/v4WB8oCBGlpssaoo8swxqxXIfXZlcrchLw w1n7Vlh7qgjZrjNaPl8FNo14U32vvhnr2B/UhsL4zkI4iccTRIX4GYE70GD/7KYUyP qFPviDlfwDyxA== Subject: [PATCH 08/24] common/fuzzy: split out each repair strategy into a separate helper From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:40 -0800 Message-ID: <167243878009.730387.6498387808305301701.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Refactor __scratch_xfs_fuzz_field_test to split out each repair strategy into a separate helper function. Signed-off-by: Darrick J. Wong --- common/fuzzy | 212 +++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 166 insertions(+), 46 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 866901931e..ef42336fa6 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -194,6 +194,148 @@ __fuzz_notify() { test -w /dev/ttyprintk && echo "$@" >> /dev/ttyprintk } +# Perform the online repair part of a fuzz test. +__scratch_xfs_fuzz_field_online() { + local fuzz_action="$1" + + # Mount or else we can't do anything online + echo "+ Mount filesystem to try online repair" + _try_scratch_mount 2>&1 + res=$? + if [ $res -ne 0 ]; then + (>&2 echo "mount failed ($res) with ${fuzz_action}.") + return 0 + fi + + # Make sure online scrub will catch whatever we fuzzed + echo "++ Online scrub" + _scratch_scrub -n -a 1 -e continue 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "scrub didn't fail with ${fuzz_action}.") + + # Try fixing the filesystem online + __fuzz_notify "++ Try to repair filesystem online" + _scratch_scrub 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "online repair failed ($res) with ${fuzz_action}.") + + __scratch_xfs_fuzz_unmount + + # Offline scrub should pass now + echo "+ Make sure error is gone (offline)" + _scratch_xfs_repair -n 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "offline re-scrub failed ($res) with ${fuzz_action}.") + + return 0 +} + +# Perform the offline repair part of a fuzz test. +__scratch_xfs_fuzz_field_offline() { + local fuzz_action="$1" + + # Mount or else we can't do anything offline + echo "+ Mount filesystem to try offline repair" + _try_scratch_mount 2>&1 + res=$? + if [ $res -ne 0 ]; then + (>&2 echo "mount failed ($res) with ${fuzz_action}.") + return 0 + fi + + # Make sure online scrub will catch whatever we fuzzed + echo "++ Online scrub" + _scratch_scrub -n -a 1 -e continue 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "scrub didn't fail with ${fuzz_action}.") + + __scratch_xfs_fuzz_unmount + + # Repair the filesystem offline + echo "+ Try to repair the filesystem offline" + _repair_scratch_fs 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "offline repair failed ($res) with ${fuzz_action}.") + + # See if repair finds a clean fs + echo "+ Make sure error is gone (offline)" + _scratch_xfs_repair -n 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "offline re-scrub failed ($res) with ${fuzz_action}.") + + return 0 +} + +# Perform the no-repair part of a fuzz test. +__scratch_xfs_fuzz_field_norepair() { + local fuzz_action="$1" + + # Mount or else we can't do anything in norepair mode + echo "+ Mount filesystem to try no repair" + _try_scratch_mount 2>&1 + res=$? + if [ $res -ne 0 ]; then + (>&2 echo "mount failed ($res) with ${fuzz_action}.") + return 0 + fi + + __scratch_xfs_fuzz_unmount + + return 0 +} + +# Perform the online-then-offline repair part of a fuzz test. +__scratch_xfs_fuzz_field_both() { + local fuzz_action="$1" + + # Mount or else we can't do anything in both repair mode + echo "+ Mount filesystem to try both repairs" + _try_scratch_mount 2>&1 + res=$? + if [ $res -ne 0 ]; then + (>&2 echo "mount failed ($res) with ${fuzz_action}.") + return 0 + fi + + # Make sure online scrub will catch whatever we fuzzed + echo "++ Online scrub" + _scratch_scrub -n -a 1 -e continue 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "online scrub didn't fail with ${fuzz_action}.") + + # Try fixing the filesystem online + __fuzz_notify "++ Try to repair filesystem online" + _scratch_scrub 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "online repair failed ($res) with ${fuzz_action}.") + + __scratch_xfs_fuzz_unmount + + # Repair the filesystem offline? + echo "+ Try to repair the filesystem offline" + _repair_scratch_fs 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "offline repair failed ($res) with ${fuzz_action}.") + + # See if repair finds a clean fs + echo "+ Make sure error is gone (offline)" + _scratch_xfs_repair -n 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "offline re-scrub ($res) with ${fuzz_action}.") + + return 0 +} + # Fuzz one field of some piece of metadata. # First arg is the field name # Second arg is the fuzz verb (ones, zeroes, random, add, sub...) @@ -211,54 +353,32 @@ __scratch_xfs_fuzz_field_test() { res=$? test $res -ne 0 && return - # Try to catch the error with scrub - echo "+ Try to catch the error" - _try_scratch_mount 2>&1 - res=$? - if [ $res -eq 0 ]; then - # Try an online scrub unless we're fuzzing ag 0's sb, - # which scrub doesn't know how to fix. - if [ "${repair}" != "none" ]; then - echo "++ Online scrub" - if [ "$1" != "sb 0" ]; then - _scratch_scrub -n -a 1 -e continue 2>&1 - res=$? - test $res -eq 0 && \ - (>&2 echo "scrub didn't fail with ${field} = ${fuzzverb}.") - fi - fi - - # Try fixing the filesystem online?! - if [ "${repair}" = "online" ] || [ "${repair}" = "both" ]; then - __fuzz_notify "++ Try to repair filesystem online" - _scratch_scrub 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "online repair failed ($res) with ${field} = ${fuzzverb}.") - fi - - __scratch_xfs_fuzz_unmount - elif [ "${repair}" = "online" ] || [ "${repair}" = "both" ]; then - (>&2 echo "mount failed ($res) with ${field} = ${fuzzverb}.") - fi - - # Repair the filesystem offline? - if [ "${repair}" = "offline" ] || [ "${repair}" = "both" ]; then - echo "+ Try to repair the filesystem offline" - _repair_scratch_fs 2>&1 + # Try to catch the error with whatever repair strategy we picked. + # The fs should not be mounted before or after the strategy call. + local fuzz_action="${field} = ${fuzzverb}" + case "${repair}" in + "online") + __scratch_xfs_fuzz_field_online "${fuzz_action}" res=$? - test $res -ne 0 && \ - (>&2 echo "offline repair failed ($res) with ${field} = ${fuzzverb}.") - fi - - # See if repair finds a clean fs - if [ "${repair}" != "none" ]; then - echo "+ Make sure error is gone (offline)" - _scratch_xfs_repair -n 2>&1 + ;; + "offline") + __scratch_xfs_fuzz_field_offline "${fuzz_action}" res=$? - test $res -ne 0 && \ - (>&2 echo "offline re-scrub ($res) with ${field} = ${fuzzverb}.") - fi + ;; + "none") + __scratch_xfs_fuzz_field_norepair "${fuzz_action}" + res=$? + ;; + "both") + __scratch_xfs_fuzz_field_both "${fuzz_action}" + res=$? + ;; + *) + (>&2 echo "unknown repair strategy ${repair}.") + res=2 + ;; + esac + test $res -eq 0 || return $res # See if scrub finds a clean fs echo "+ Make sure error is gone (online)" From patchwork Fri Dec 30 22:19:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085238 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C899C4332F for ; Sat, 31 Dec 2022 00:46:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235937AbiLaAqa (ORCPT ); Fri, 30 Dec 2022 19:46:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235927AbiLaAq3 (ORCPT ); Fri, 30 Dec 2022 19:46:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FEE255BF; Fri, 30 Dec 2022 16:46:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F3E961D61; Sat, 31 Dec 2022 00:46:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05A96C433D2; Sat, 31 Dec 2022 00:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447588; bh=9VwwU7hTMZIES10TLAMkoJh3qKz4roC3+OsqD38DEiU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=nNjlE7f79fABxy5zkbYsj7xy4Ift0mUZoHMnNXkl8oFG509qujuAdzYKWcRcWAjWt YYqRU1LXLMMY5faJoLAl8dpy/rKdbJkShBPkEqxEHqDRwl1pk9WqiYGHDX7bozfpLE 5PmR/jg/LesJ8n89Ffb4uAkT/NFLyNdsHtVfh4FX+JPANrEPTFs/Y/lK+JlZLL5tRU h0PqZ2f2lFmZKfWRTpX3HuMI6BmKSe6PXM2C5L1UD4azHWoIhQTQNzOsFE2Ssj5IXe GtXauOrajhzTqEDR8vV85+tfn8g+/Hq3MMJQOVuPIbqwA30zxs9PvPAOYqFADGkRMk xIsFwgdaWt1WQ== Subject: [PATCH 09/24] common/fuzzy: add an underline to the full log between sections From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:40 -0800 Message-ID: <167243878022.730387.11367148207366685525.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong The fuzz scripts use __fuzz_notify in effect to log each step in the fuzz process. Enhance it to print an "underline" to ease readability a bit. Signed-off-by: Darrick J. Wong --- common/fuzzy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/fuzzy b/common/fuzzy index ef42336fa6..7efa5eeaf7 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -190,7 +190,9 @@ __scratch_xfs_fuzz_mdrestore() } __fuzz_notify() { + echo '========================================' echo "$@" + echo '========================================' test -w /dev/ttyprintk && echo "$@" >> /dev/ttyprintk } @@ -348,7 +350,6 @@ __scratch_xfs_fuzz_field_test() { # Set the new field value __fuzz_notify "+ Fuzz ${field} = ${fuzzverb}" - echo "========================" _scratch_xfs_fuzz_metadata_field "${field}" ${fuzzverb} "$@" res=$? test $res -ne 0 && return From patchwork Fri Dec 30 22:19:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B100C4708E for ; Sat, 31 Dec 2022 00:46:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235944AbiLaAqq (ORCPT ); Fri, 30 Dec 2022 19:46:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235927AbiLaAqp (ORCPT ); Fri, 30 Dec 2022 19:46:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 941451117D; Fri, 30 Dec 2022 16:46:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3026661D61; Sat, 31 Dec 2022 00:46:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91776C433D2; Sat, 31 Dec 2022 00:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447603; bh=6WFWw1kRbCys3xc/fWAkBwSJNwV2wh9829aSxPbQYms=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=vN3IIleau7fv0Fwzh/NKbKVvChAz4mQRs9hdslLxfhsYm4C6YKZGkwkNGFhL1BY0M z+grZ71Olou/uo6xdyPhMlqAU5Nwv/O5jRr9GcJuZyzE9onASyDqOr5EpywcYfdarf Y6+ckx+y7/Z5g+b4d6BbEkUPQIrnP8nS0Q72uPJ44HAScRwRpHGWCD0X+Z85unBNEH eN0wZtqgP8EgkIzYS42j0nIRR/xVL9IMHyOXOvW3H4JGiewEzYgQ1ML6ONhQ/8Ho+x Ywd7Pk+om+UxbL2sRmG06ypJs/i0h/dg9J7KkDFJaIV4/8McZb5fIxBcA9PSscojBY 8IuKjqOB3Rp8Q== Subject: [PATCH 10/24] common/fuzzy: hoist the post-repair fs modification step From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:40 -0800 Message-ID: <167243878035.730387.5749474229580708524.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Hoist the code that tries to modify an fs after repairing our fuzz damage into a separate function, so that we can further simplify the caller. Signed-off-by: Darrick J. Wong --- common/fuzzy | 77 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 7efa5eeaf7..e90f414d34 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -338,6 +338,47 @@ __scratch_xfs_fuzz_field_both() { return 0 } +# Assess the state of the filesystem after a repair strategy has been run by +# trying to make changes to it. +_scratch_xfs_fuzz_field_modifyfs() { + local fuzz_action="$1" + local repair="$2" + + # Try to mount the filesystem + echo "+ Make sure error is gone (online)" + _try_scratch_mount 2>&1 + res=$? + if [ $res -eq 0 ]; then + # Make sure online scrub says the filesystem is clean now + if [ "${repair}" != "none" ]; then + echo "++ Online scrub" + _scratch_scrub -n -e continue 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "online re-scrub ($res) with ${field} = ${fuzzverb}.") + fi + fi + + # Try modifying the filesystem again + __fuzz_notify "++ Try to write filesystem again" + _scratch_fuzz_modify 100 2>&1 + __scratch_xfs_fuzz_unmount + else + (>&2 echo "re-mount failed ($res) with ${fuzz_action}.") + fi + + # See if repair finds a clean fs + if [ "${repair}" != "none" ]; then + echo "+ Re-check the filesystem (offline)" + _scratch_xfs_repair -n 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "re-repair failed ($res) with ${field} = ${fuzzverb}.") + fi + + return 0 +} + # Fuzz one field of some piece of metadata. # First arg is the field name # Second arg is the fuzz verb (ones, zeroes, random, add, sub...) @@ -381,39 +422,9 @@ __scratch_xfs_fuzz_field_test() { esac test $res -eq 0 || return $res - # See if scrub finds a clean fs - echo "+ Make sure error is gone (online)" - _try_scratch_mount 2>&1 - res=$? - if [ $res -eq 0 ]; then - # Try an online scrub unless we're fuzzing ag 0's sb, - # which scrub doesn't know how to fix. - if [ "${repair}" != "none" ]; then - echo "++ Online scrub" - if [ "$1" != "sb 0" ]; then - _scratch_scrub -n -e continue 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "online re-scrub ($res) with ${field} = ${fuzzverb}.") - fi - fi - - # Try modifying the filesystem again! - __fuzz_notify "++ Try to write filesystem again" - _scratch_fuzz_modify 100 2>&1 - __scratch_xfs_fuzz_unmount - else - (>&2 echo "re-mount failed ($res) with ${field} = ${fuzzverb}.") - fi - - # See if repair finds a clean fs - if [ "${repair}" != "none" ]; then - echo "+ Re-check the filesystem (offline)" - _scratch_xfs_repair -n 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "re-repair failed ($res) with ${field} = ${fuzzverb}.") - fi + # See what happens when we modify the fs + _scratch_xfs_fuzz_field_modifyfs "${fuzz_action}" "${repair}" + return $? } # Make sure we have all the pieces we need for field fuzzing From patchwork Fri Dec 30 22:19:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085240 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8EC9C4332F for ; Sat, 31 Dec 2022 00:47:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235946AbiLaArD (ORCPT ); Fri, 30 Dec 2022 19:47:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235927AbiLaArC (ORCPT ); Fri, 30 Dec 2022 19:47:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A04EF1C90A; Fri, 30 Dec 2022 16:47:01 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D73FB81D68; Sat, 31 Dec 2022 00:47:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22F98C433D2; Sat, 31 Dec 2022 00:46:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447619; bh=2S9+pgHHA1t+8JkskRd1FzxnP7+67kCrRVzQkDL717Y=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=DCA4urG/SfB7Q/6Tc7q22uosZDGpNq3oyEYEGc9695IyTVkH4nSCG79ADCAQgBYIF CrY/QtA8rRVs4Iuj7cbqM4KWgcUTyiXu+gCBKy3v1/2AyDZ5mkGlVyhNir3zJrGLum ms6H/fl9iRARkfF64oLcfc9XDU9cDCbzvYmBN9K8zQ/WBGnYtScEsam84cTvDVgNEM Yci5BjEr+66igwFF+us0wWvudoPmn98GV4ppOYW2OWnRXu0RqWddB3SddutO4XPqlU N0pn+1gC+6YFe60i2IJHmj7DIgn2ICM07NjABIBifYpo/wu1LnyUoXp2gzwmU2lEOs 6AiBeTADEHghw== Subject: [PATCH 11/24] common/fuzzy: fix some problems with the online repair strategy From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:40 -0800 Message-ID: <167243878049.730387.5152774047260379132.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong While auditing the fuzz tester code, I noticed there were numerous problems with the online repair strategy -- the stages of the strategy are not consistently logged to the kernel log, some of the error messages don't identify /which/ scrubber we're calling, and we don't actually re-run online scrub after a repair to make sure that it's verification is ok. Disable xfs_repair prefetch to reduce the chances of an OOM kill, and abort the fuzz test if we can't mount. We also reorganize the error messages to make reading the golden output easier. Signed-off-by: Darrick J. Wong --- common/fuzzy | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index e90f414d34..8b52d289d1 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -201,36 +201,43 @@ __scratch_xfs_fuzz_field_online() { local fuzz_action="$1" # Mount or else we can't do anything online - echo "+ Mount filesystem to try online repair" + __fuzz_notify "+ Mount filesystem to try online repair" _try_scratch_mount 2>&1 res=$? if [ $res -ne 0 ]; then - (>&2 echo "mount failed ($res) with ${fuzz_action}.") - return 0 + (>&2 echo "${fuzz_action}: mount failed ($res).") + return 1 fi # Make sure online scrub will catch whatever we fuzzed - echo "++ Online scrub" + __fuzz_notify "++ Detect fuzzed field (online)" _scratch_scrub -n -a 1 -e continue 2>&1 res=$? test $res -eq 0 && \ - (>&2 echo "scrub didn't fail with ${fuzz_action}.") + (>&2 echo "${fuzz_action}: online scrub didn't fail.") # Try fixing the filesystem online - __fuzz_notify "++ Try to repair filesystem online" + __fuzz_notify "++ Try to repair filesystem (online)" _scratch_scrub 2>&1 res=$? test $res -ne 0 && \ - (>&2 echo "online repair failed ($res) with ${fuzz_action}.") + (>&2 echo "${fuzz_action}: online repair failed ($res).") + + # Online scrub should pass now + __fuzz_notify "++ Make sure error is gone (online)" + _scratch_scrub -n -a 1 -e continue 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "${fuzz_action}: online re-scrub failed ($res).") __scratch_xfs_fuzz_unmount # Offline scrub should pass now - echo "+ Make sure error is gone (offline)" - _scratch_xfs_repair -n 2>&1 + __fuzz_notify "+ Make sure error is gone (offline)" + _scratch_xfs_repair -P -n 2>&1 res=$? test $res -ne 0 && \ - (>&2 echo "offline re-scrub failed ($res) with ${fuzz_action}.") + (>&2 echo "${fuzz_action}: offline re-scrub failed ($res).") return 0 } From patchwork Fri Dec 30 22:19:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CB07C4332F for ; Sat, 31 Dec 2022 00:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235947AbiLaArT (ORCPT ); Fri, 30 Dec 2022 19:47:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235927AbiLaArS (ORCPT ); Fri, 30 Dec 2022 19:47:18 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 741BC1C921; Fri, 30 Dec 2022 16:47:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1F8D2B81E6C; Sat, 31 Dec 2022 00:47:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D386EC433D2; Sat, 31 Dec 2022 00:47:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447634; bh=yIDSzMfEjuPZlNoi3JLGEwuIFaCmde6EJxyncZPGInY=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=oWmGvF79ho8k/DoqjE4tGL0J3nm0aO6lp/xdNu1pRN+DFjnOvR0heydXw/zMW/asU tXo5n1+QObvEBoJY80l/bcUqlKIIQiEyCceRsnIbaWDgmgTSmmdYtxwYk67VgV2x2s rHcOmInaGQ/RSus5m7eXCxZbL0bRQ2ZV3ybGDtaSfBEFRwTFmUnyTAhM8+epbfca79 10CtnRQsqYgYuDEnMQvBSUoLnKl/NbeeZqPrAwbvHW6xOdYrsTzDP+6vNta0oWQ8gb U01R+jC9ocHjJTdnLwr13QZZoOZttVU8PQ57XcR1OBPboIb0uA+KvZ2iiAklrRIsZK cWxljEXPs/XHQ== Subject: [PATCH 12/24] common/fuzzy: fix some problems with the offline repair strategy From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:40 -0800 Message-ID: <167243878062.730387.10548023765273866268.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong While auditing the fuzz tester code, I noticed there were numerous problems with the offline repair strategy -- the stages of the strategy are not consistently logged to the kernel log, we don't actually check that repair -n finds the fuzzed field, and since this is an offline test, we don't need or want to mount or try to run the online scrubber. Also, disable prefetch to reduce the chance of an OOM kill. Rework the error messages to make reading the golden output easier. Signed-off-by: Darrick J. Wong --- common/fuzzy | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 8b52d289d1..07f597627c 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -246,37 +246,26 @@ __scratch_xfs_fuzz_field_online() { __scratch_xfs_fuzz_field_offline() { local fuzz_action="$1" - # Mount or else we can't do anything offline - echo "+ Mount filesystem to try offline repair" - _try_scratch_mount 2>&1 - res=$? - if [ $res -ne 0 ]; then - (>&2 echo "mount failed ($res) with ${fuzz_action}.") - return 0 - fi - - # Make sure online scrub will catch whatever we fuzzed - echo "++ Online scrub" - _scratch_scrub -n -a 1 -e continue 2>&1 + # Make sure offline scrub will catch whatever we fuzzed + __fuzz_notify "+ Detect fuzzed field (offline)" + _scratch_xfs_repair -P -n 2>&1 res=$? test $res -eq 0 && \ - (>&2 echo "scrub didn't fail with ${fuzz_action}.") - - __scratch_xfs_fuzz_unmount + (>&2 echo "${fuzz_action}: offline scrub didn't fail.") # Repair the filesystem offline - echo "+ Try to repair the filesystem offline" - _repair_scratch_fs 2>&1 + __fuzz_notify "+ Try to repair the filesystem (offline)" + _repair_scratch_fs -P 2>&1 res=$? test $res -ne 0 && \ - (>&2 echo "offline repair failed ($res) with ${fuzz_action}.") + (>&2 echo "${fuzz_action}: offline repair failed ($res).") # See if repair finds a clean fs - echo "+ Make sure error is gone (offline)" - _scratch_xfs_repair -n 2>&1 + __fuzz_notify "+ Make sure error is gone (offline)" + _scratch_xfs_repair -P -n 2>&1 res=$? test $res -ne 0 && \ - (>&2 echo "offline re-scrub failed ($res) with ${fuzz_action}.") + (>&2 echo "${fuzz_action}: offline re-scrub failed ($res).") return 0 } From patchwork Fri Dec 30 22:19:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085242 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D645CC4332F for ; Sat, 31 Dec 2022 00:47:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235885AbiLaAre (ORCPT ); Fri, 30 Dec 2022 19:47:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235927AbiLaArc (ORCPT ); Fri, 30 Dec 2022 19:47:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D5D71C90A; Fri, 30 Dec 2022 16:47:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0C2B861D5F; Sat, 31 Dec 2022 00:47:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 687AAC433D2; Sat, 31 Dec 2022 00:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447650; bh=INURyWHALQie39VL7Dws4eI73u90p3cSfQVEvYfOorY=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=rcfESciM8u+V8/F0ussKseUK/oo4O0NyBCIOybRemAN8WKsxYOgz/KK2aAtEfV5Q0 +ZZjYbrqOJsq9Ql8wh/r4hO+TTYPn8lwNr8rxpdd77+gAjID1sUwVys8sQ3APlPwui hjOlG0N8MtaLBBXAR0chtQZXI2LoGOTcoywcBKgDgd7yayeG4ISoof+RysI73LWzDl ps9vxUIYtVb+6mGCGigyjtpp4mf4FbxNr3V4ZAROG7age394P0qn1yqKYoBk0mFzCX yCT1wULKb4tij54y14wWpnUZH7rkdncZ6OO9oM4t9sqV/+7ahh6SB6qqALvj97T8Cw T258LPbnP7sdA== Subject: [PATCH 13/24] common/fuzzy: fix some problems with the no-repair strategy From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:40 -0800 Message-ID: <167243878075.730387.14082368456840772775.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong While auditing the fuzz tester code, I noticed there were numerous problems with the no repair strategy -- the stages of the strategy are not consistently logged to the kernel log, and we don't actually verify that either online or offline scrubs notice the fuzz. Rework the error messages to make reading the golden output easier. Signed-off-by: Darrick J. Wong --- common/fuzzy | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 07f597627c..16fca67534 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -274,15 +274,29 @@ __scratch_xfs_fuzz_field_offline() { __scratch_xfs_fuzz_field_norepair() { local fuzz_action="$1" + # Make sure offline scrub will catch whatever we fuzzed + __fuzz_notify "+ Detect fuzzed field (offline)" + _scratch_xfs_repair -P -n 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "${fuzz_action}: offline scrub didn't fail.") + # Mount or else we can't do anything in norepair mode - echo "+ Mount filesystem to try no repair" + __fuzz_notify "+ Mount filesystem to try online scan" _try_scratch_mount 2>&1 res=$? if [ $res -ne 0 ]; then - (>&2 echo "mount failed ($res) with ${fuzz_action}.") - return 0 + (>&2 echo "${fuzz_action}: mount failed ($res).") + return 1 fi + # Make sure online scrub will catch whatever we fuzzed + __fuzz_notify "++ Detect fuzzed field (online)" + _scratch_scrub -n -a 1 -e continue 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "${fuzz_action}: online scrub didn't fail.") + __scratch_xfs_fuzz_unmount return 0 From patchwork Fri Dec 30 22:19:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C748BC4332F for ; Sat, 31 Dec 2022 00:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235947AbiLaArs (ORCPT ); Fri, 30 Dec 2022 19:47:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235927AbiLaArr (ORCPT ); Fri, 30 Dec 2022 19:47:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA59B1C90A; Fri, 30 Dec 2022 16:47:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 882FE61D5F; Sat, 31 Dec 2022 00:47:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9023C433D2; Sat, 31 Dec 2022 00:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447666; bh=dBIFgGCfTw8/pgQf0NYYFCMIwKpmMJBXQ28G0Aqh2lY=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=TpdI7vNuEAwhAv7UQQegtfw/T9lQxMBX+VM200Hv7u+PA1MijmmSit4UungSZlqQW 6aeVLqEb7oSVTOFz986/nTsE44iRE1q0zUi51V/4V2udLYc6nzdxJBxo4JfYh3ys4Z 8VS5bTqmzkFoFWwbL7h+ftUFCIJfVRp4idfncA8LdtJCzCusWL/mvC/7Vr7M3vdGjZ R0QBAkLnrzE68hMc32sH4TW7tVf0NUrnRwKuZHVaqddrPISau+mDA7pr/umDsQVaPM gQ92QkRnSIazEzccE7iYFJotHPunVb6X12L9EPa7HV+/ri9jMDx8Y2k8lwjBfMuKbc Nn8qJwvEBEk3w== Subject: [PATCH 14/24] common/fuzzy: fix some problems with the online-then-offline repair strategy From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:40 -0800 Message-ID: <167243878089.730387.3339474427317162674.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong While auditing the fuzz tester code, I noticed there were numerous problems with the online-then-offline repair strategy -- the stages of the strategy are not consistently logged to the kernel log, some of the error messages don't identify /which/ scrubber we're calling, we don't do a pre-repair check to make sure we detect the fuzzed fields, and we don't actually re-run online scrub after a repair to make sure that it's ok. Disable xfs_repair prefetch to reduce the possibility of OOM kills. Rework the error messages to make reading the golden output easier. Signed-off-by: Darrick J. Wong --- common/fuzzy | 80 ++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 27 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 16fca67534..a33c230b40 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -306,45 +306,71 @@ __scratch_xfs_fuzz_field_norepair() { __scratch_xfs_fuzz_field_both() { local fuzz_action="$1" + # Make sure offline scrub will catch whatever we fuzzed + __fuzz_notify "+ Detect fuzzed field (offline)" + _scratch_xfs_repair -P -n 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "${fuzz_action}: offline scrub didn't fail.") + # Mount or else we can't do anything in both repair mode - echo "+ Mount filesystem to try both repairs" + __fuzz_notify "+ Mount filesystem to try both repairs" _try_scratch_mount 2>&1 res=$? if [ $res -ne 0 ]; then - (>&2 echo "mount failed ($res) with ${fuzz_action}.") - return 0 + (>&2 echo "${fuzz_action}: mount failed ($res).") + else + # Make sure online scrub will catch whatever we fuzzed + __fuzz_notify "++ Detect fuzzed field (online)" + _scratch_scrub -n -a 1 -e continue 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "${fuzz_action}: online scrub didn't fail.") + + # Try fixing the filesystem online + __fuzz_notify "++ Try to repair filesystem (online)" + _scratch_scrub 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "${fuzz_action}: online repair failed ($res).") + + __scratch_xfs_fuzz_unmount + fi + + # Repair the filesystem offline if online repair failed? + if [ $res -ne 0 ]; then + __fuzz_notify "+ Try to repair the filesystem (offline)" + _repair_scratch_fs -P 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "${fuzz_action}: offline repair failed ($res).") + fi + + # See if repair finds a clean fs + __fuzz_notify "+ Make sure error is gone (offline)" + _scratch_xfs_repair -P -n 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "${fuzz_action}: offline re-scrub failed ($res).") + + # Mount so that we can see what scrub says after we've fixed the fs + __fuzz_notify "+ Re-mount filesystem to re-try online scan" + _try_scratch_mount 2>&1 + res=$? + if [ $res -ne 0 ]; then + (>&2 echo "${fuzz_action}: mount failed ($res).") + return 1 fi - # Make sure online scrub will catch whatever we fuzzed - echo "++ Online scrub" + # Online scrub should pass now + __fuzz_notify "++ Make sure error is gone (online)" _scratch_scrub -n -a 1 -e continue 2>&1 res=$? - test $res -eq 0 && \ - (>&2 echo "online scrub didn't fail with ${fuzz_action}.") - - # Try fixing the filesystem online - __fuzz_notify "++ Try to repair filesystem online" - _scratch_scrub 2>&1 - res=$? test $res -ne 0 && \ - (>&2 echo "online repair failed ($res) with ${fuzz_action}.") + (>&2 echo "${fuzz_action}: online re-scrub failed ($res).") __scratch_xfs_fuzz_unmount - # Repair the filesystem offline? - echo "+ Try to repair the filesystem offline" - _repair_scratch_fs 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "offline repair failed ($res) with ${fuzz_action}.") - - # See if repair finds a clean fs - echo "+ Make sure error is gone (offline)" - _scratch_xfs_repair -n 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "offline re-scrub ($res) with ${fuzz_action}.") - return 0 } From patchwork Fri Dec 30 22:19:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085244 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03460C4332F for ; Sat, 31 Dec 2022 00:48:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235927AbiLaAsG (ORCPT ); Fri, 30 Dec 2022 19:48:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235851AbiLaAsF (ORCPT ); Fri, 30 Dec 2022 19:48:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 035341C90A; Fri, 30 Dec 2022 16:48:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B3D4FB81DE6; Sat, 31 Dec 2022 00:48:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74415C433D2; Sat, 31 Dec 2022 00:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447681; bh=1wtoFtDm/6CQJOn2zVo4LsS5ocZt8ThnrjDTHAKBiR8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=cm2stuGqhFtK8yvjD1ujabqfwf5cJT3mfvUmRNrvRehyH0SBgSov0Ki+G7yuQkHZ6 jdYgSXr3j1hy3k5dk6o3tBQAdaHQrg400Shp4HjXKkE2O4N4g/9Rk2rw1wpGqcStpI jr8bTMV7BJVXilyfzAXSMU3vPBGnbVvUqXCFhNKkNaW3f4Rini/yZxPG8RjZL3xca0 ysokw4l3m/U/KwhR1rj2C9gBezBP5pD823z2KjmVk55UEnqX6wqDnWpiW1Rhj77L9Y n1dgYEVBrw6iqS7UqeXpCIzTEhl1+kkL2gev/BRlY493LURMbORZfQp8F3t7YnGuc1 JB3nCFDlo49Gg== Subject: [PATCH 15/24] common/fuzzy: fix some problems with the post-repair fs modification code From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:41 -0800 Message-ID: <167243878102.730387.2695454576885664463.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong While auditing the fuzz tester code, I noticed there were numerous problems with the code that test-drives the filesystem after we've run the repair strategy. Now that we've made sure that the repair strategy checks its own efficacy, we can rearrange this function to try making mods and then re-check the filesystem afterwards. Also, disable xfs_repair prefetch to reduce the likelihood of OOM kills. Signed-off-by: Darrick J. Wong --- common/fuzzy | 56 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index a33c230b40..e9a5d67592 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -380,37 +380,43 @@ _scratch_xfs_fuzz_field_modifyfs() { local fuzz_action="$1" local repair="$2" - # Try to mount the filesystem - echo "+ Make sure error is gone (online)" + # Try to mount the filesystem so that we can make changes + __fuzz_notify "+ Mount filesystem to make changes" _try_scratch_mount 2>&1 res=$? - if [ $res -eq 0 ]; then - # Make sure online scrub says the filesystem is clean now - if [ "${repair}" != "none" ]; then - echo "++ Online scrub" - _scratch_scrub -n -e continue 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "online re-scrub ($res) with ${field} = ${fuzzverb}.") - fi - fi + if [ $res -ne 0 ]; then + (>&2 echo "${fuzz_action}: pre-mod mount failed ($res).") + return $res + fi - # Try modifying the filesystem again - __fuzz_notify "++ Try to write filesystem again" - _scratch_fuzz_modify 100 2>&1 + # Try modifying the filesystem again + __fuzz_notify "++ Try to write filesystem again" + _scratch_fuzz_modify 100 2>&1 + + # If we didn't repair anything, there's no point in checking further, + # the fs is still corrupt. + if [ "${repair}" = "none" ]; then __scratch_xfs_fuzz_unmount - else - (>&2 echo "re-mount failed ($res) with ${fuzz_action}.") + return 0 fi - # See if repair finds a clean fs - if [ "${repair}" != "none" ]; then - echo "+ Re-check the filesystem (offline)" - _scratch_xfs_repair -n 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "re-repair failed ($res) with ${field} = ${fuzzverb}.") - fi + # Run an online check to make sure the fs is still ok, unless we + # are running the norepair strategy. + __fuzz_notify "+ Re-check the filesystem (online)" + _scratch_scrub -n -e continue 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "${fuzz_action}: online post-mod scrub failed ($res).") + + __scratch_xfs_fuzz_unmount + + # Run an offline check to make sure the fs is still ok, unless we + # are running the norepair strategy. + __fuzz_notify "+ Re-check the filesystem (offline)" + _scratch_xfs_repair -P -n 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "${fuzz_action}: offline post-mod scrub failed ($res).") return 0 } From patchwork Fri Dec 30 22:19:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4824AC4332F for ; Sat, 31 Dec 2022 00:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235951AbiLaAsT (ORCPT ); Fri, 30 Dec 2022 19:48:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235851AbiLaAsS (ORCPT ); Fri, 30 Dec 2022 19:48:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1652E1C90A; Fri, 30 Dec 2022 16:48:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AA4FF61D5F; Sat, 31 Dec 2022 00:48:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1345EC433D2; Sat, 31 Dec 2022 00:48:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447697; bh=c8QkEqe00lw8DQ0TO3dWToOxaWxUcwYcOP0E/w0lp1k=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=e3x/uW3q5Bkm+hf4lHUKE4DLuxbl2X0SygOtv0DAcKXa86PCBSUVIAit5H++pav3d +lU/bNUvvZJYK8quiBZdRK92OXRMAjeQyq+gDU+sppsvrHzQ3wGDBNs8Kt9qPs48KB OETchGE8ffCy8E//5watHGAmDRhuc/xNIOBUo/KM/neXp6eoWanWj6+PjtGH+ieMTI KHq2GMrDc/2X3PzO/4tvmyYY58g8mDUZmPUFNNd6lpw0LmdjC3tGfdpQHkZq2BRc8L PZk8ABXfAivUKRugYsLpgovTFCddftjIO0qLkJ/XgqD1poBD1egEoaiHT+SoGLdSz3 +kakcAmH/M4UQ== Subject: [PATCH 16/24] xfs/{35[45],455}: fix bogus corruption errors From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:41 -0800 Message-ID: <167243878115.730387.3527984376924446960.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong The AGFL fuzz tests first fuzz the entire block header, and second extract flfirst from the AGF header to start a second round of targeted fuzzing of live bno pointers in the AGFL. However, flfirst (and the AGFL field detection at the start of the second round of fuzzing) are detected after we've already been fuzz testing, which means that the AGFL might be garbage because repair failed or was not called. If this is the case, test will fail because the _scratch_xfs_db -c 'agf 0' -c 'p flfirst' call emits things like this: Fuzz AGFL flfirst Metadata corruption detected at 0x55f4f789fbc0, xfs_agfl block 0x3/0x200 Metadata corruption detected at 0x55b7356e0bc0, xfs_agfl block 0x3/0x200 Done fuzzing AGFL flfirst Fix this by restoring the scratch fs before probing flfirst and starting the second round of fuzzing. Signed-off-by: Darrick J. Wong --- tests/xfs/354 | 7 ++++++- tests/xfs/355 | 7 ++++++- tests/xfs/455 | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/xfs/354 b/tests/xfs/354 index b10ce1d68f..8abf527ea6 100755 --- a/tests/xfs/354 +++ b/tests/xfs/354 @@ -28,8 +28,13 @@ echo "Fuzz AGFL" _scratch_xfs_fuzz_metadata '' 'offline' 'agfl 0' >> $seqres.full echo "Done fuzzing AGFL" -echo "Fuzz AGFL flfirst" +# Restore a correct copy of the filesystem before we start the second round of +# fuzzing. This avoids corruption errors from xfs_db when we probe for flfirst +# in the AGF and later when _scratch_xfs_fuzz_metadata probes the AGFL fields. +__scratch_xfs_fuzz_mdrestore flfirst=$(_scratch_xfs_db -c 'agf 0' -c 'p flfirst' | sed -e 's/flfirst = //g') + +echo "Fuzz AGFL flfirst" SCRATCH_XFS_LIST_METADATA_FIELDS="bno[${flfirst}]" _scratch_xfs_fuzz_metadata '' 'offline' 'agfl 0' >> $seqres.full echo "Done fuzzing AGFL flfirst" diff --git a/tests/xfs/355 b/tests/xfs/355 index 530c9a970a..2d552a591c 100755 --- a/tests/xfs/355 +++ b/tests/xfs/355 @@ -28,8 +28,13 @@ echo "Fuzz AGFL" _scratch_xfs_fuzz_metadata '' 'online' 'agfl 0' >> $seqres.full echo "Done fuzzing AGFL" -echo "Fuzz AGFL flfirst" +# Restore a correct copy of the filesystem before we start the second round of +# fuzzing. This avoids corruption errors from xfs_db when we probe for flfirst +# in the AGF and later when _scratch_xfs_fuzz_metadata probes the AGFL fields. +__scratch_xfs_fuzz_mdrestore flfirst=$(_scratch_xfs_db -c 'agf 0' -c 'p flfirst' | sed -e 's/flfirst = //g') + +echo "Fuzz AGFL flfirst" SCRATCH_XFS_LIST_METADATA_FIELDS="bno[${flfirst}]" _scratch_xfs_fuzz_metadata '' 'online' 'agfl 0' >> $seqres.full echo "Done fuzzing AGFL flfirst" diff --git a/tests/xfs/455 b/tests/xfs/455 index 96820bc3b8..9f06c71fa2 100755 --- a/tests/xfs/455 +++ b/tests/xfs/455 @@ -29,8 +29,13 @@ echo "Fuzz AGFL" _scratch_xfs_fuzz_metadata '' 'none' 'agfl 0' >> $seqres.full echo "Done fuzzing AGFL" -echo "Fuzz AGFL flfirst" +# Restore a correct copy of the filesystem before we start the second round of +# fuzzing. This avoids corruption errors from xfs_db when we probe for flfirst +# in the AGF and later when _scratch_xfs_fuzz_metadata probes the AGFL fields. +__scratch_xfs_fuzz_mdrestore flfirst=$(_scratch_xfs_db -c 'agf 0' -c 'p flfirst' | sed -e 's/flfirst = //g') + +echo "Fuzz AGFL flfirst" SCRATCH_XFS_LIST_METADATA_FIELDS="bno[${flfirst}]" _scratch_xfs_fuzz_metadata '' 'none' 'agfl 0' >> $seqres.full echo "Done fuzzing AGFL flfirst" From patchwork Fri Dec 30 22:19:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF386C4332F for ; Sat, 31 Dec 2022 00:48:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235851AbiLaAso (ORCPT ); Fri, 30 Dec 2022 19:48:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235834AbiLaAsf (ORCPT ); Fri, 30 Dec 2022 19:48:35 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2423B1C90A; Fri, 30 Dec 2022 16:48:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D7F8AB81DAF; Sat, 31 Dec 2022 00:48:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9379FC433D2; Sat, 31 Dec 2022 00:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447712; bh=Jz+QHhSSZtzitkTImYkhY+r3TEqNMGIf2bOSiP1y6yo=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=szL63PlSDIMZVJ0Hy4sgAUuWpd5oAQp9m3LyudPmycA7ijhcZJlv0A4QhxaVqJOrW REu8msTBLIXsVj2l3wFP5tu34lhqw+FrP6ZxG6NDs2bPGe7TvXQBuhw3EVHusj5J4z xC09jyRm+XreeGi6rKoM7HGYGxQF+eQ6S5uF91O1yxu1IEQhku/jGu9hTDBpVCUXnh GzkzzePQ6yOl1sncfBxca7Y61VYlR2bH0CPZc/fh/rny+6LwEKJa3ygOYOaF5f1W4l 404KWA9yPJd0I1V/F4C5AlmTmw477NvukJv7scJ9GYTKKcD3B0FgRa+GsufoAKgu62 2kt68Oozftsng== Subject: [PATCH 17/24] common/fuzzy: evaluate xfs_check vs xfs_repair From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:41 -0800 Message-ID: <167243878128.730387.16863204052245480568.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong When fuzzing a filesystem and using the offline repair strategy, compare the outputs of xfs_check against xfs_repair to ensure that the newer xfs_repair catches at least as many things as xfs_check does. Signed-off-by: Darrick J. Wong --- common/fuzzy | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/fuzzy b/common/fuzzy index e9a5d67592..cf085f8b28 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -253,6 +253,17 @@ __scratch_xfs_fuzz_field_offline() { test $res -eq 0 && \ (>&2 echo "${fuzz_action}: offline scrub didn't fail.") + # Make sure xfs_repair catches at least as many things as the old + # xfs_check did. + if [ -n "${SCRATCH_XFS_FUZZ_CHECK}" ]; then + __fuzz_notify "+ Detect fuzzed field (xfs_check)" + _scratch_xfs_check 2>&1 + res1=$? + if [ $res1 -ne 0 ] && [ $res -eq 0 ]; then + (>&2 echo "${fuzz_action}: xfs_repair passed but xfs_check failed ($res1).") + fi + fi + # Repair the filesystem offline __fuzz_notify "+ Try to repair the filesystem (offline)" _repair_scratch_fs -P 2>&1 From patchwork Fri Dec 30 22:19:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8A2AC4332F for ; Sat, 31 Dec 2022 00:48:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235834AbiLaAsy (ORCPT ); Fri, 30 Dec 2022 19:48:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235953AbiLaAsv (ORCPT ); Fri, 30 Dec 2022 19:48:51 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C40A81C921; Fri, 30 Dec 2022 16:48:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 82741B81DAF; Sat, 31 Dec 2022 00:48:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28DCBC433D2; Sat, 31 Dec 2022 00:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447728; bh=4BHdVO5u7Fx1QSmqvqHGoDSx/S5p/HWHJwtW3AVZlI8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=kk0TMerfFYOGVX1O4122V9vuevnw82+jYMrJkcA0uGriUiK+y6stU96GYoLEUqJOb Idarhk7M5e3UfdwoNrppLmTtgVYskVT5+kYS6fnnwRD0HyoeG4LC/Mi84j4u1ySInx c8e+HEBjCUrTLew/W9yNjcnpXGly3BJHKruk9oyBKuBWzYQzz2CHt7FH2wMa7VFBld p4F/mo9hFjxYtohNOQ90/SHuPnQ6uHW33KEOgzxO0cY2hh6HH5CvsYmeoxeZo590Nd s5A93rNhRiKIhzrnFvVU4LkH1nOKQYtZEsunh1odSGzyJUvGw7W44mUU25e7h0gjnR WX80urSe3HI1Q== Subject: [PATCH 18/24] common: check xfs health after doing an online scrub From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:41 -0800 Message-ID: <167243878140.730387.8820397468231187961.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong After we've run xfs_scrub -n to perform a check of a mounted filesystem's metadata, we should check the health reporting system to make sure that the results got recorded. Also wire this up to the xfs fuzz testing helpers. Signed-off-by: Darrick J. Wong --- common/fuzzy | 27 +++++++++++++++++++++++++++ common/xfs | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/common/fuzzy b/common/fuzzy index cf085f8b28..d841d435eb 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -216,6 +216,15 @@ __scratch_xfs_fuzz_field_online() { test $res -eq 0 && \ (>&2 echo "${fuzz_action}: online scrub didn't fail.") + # Does the health status report reflect the corruption? + if [ $res -ne 0 ]; then + __fuzz_notify "++ Detect fuzzed field ill-health report" + _check_xfs_health $SCRATCH_MNT 2>&1 + res=$? + test $res -ne 1 && \ + (>&2 echo "${fuzz_action}: online health check failed ($res).") + fi + # Try fixing the filesystem online __fuzz_notify "++ Try to repair filesystem (online)" _scratch_scrub 2>&1 @@ -308,6 +317,15 @@ __scratch_xfs_fuzz_field_norepair() { test $res -eq 0 && \ (>&2 echo "${fuzz_action}: online scrub didn't fail.") + # Does the health status report reflect the corruption? + if [ $res -ne 0 ]; then + __fuzz_notify "++ Detect fuzzed field ill-health report" + _check_xfs_health $SCRATCH_MNT 2>&1 + res=$? + test $res -ne 1 && \ + (>&2 echo "${fuzz_action}: online health check failed ($res).") + fi + __scratch_xfs_fuzz_unmount return 0 @@ -338,6 +356,15 @@ __scratch_xfs_fuzz_field_both() { test $res -eq 0 && \ (>&2 echo "${fuzz_action}: online scrub didn't fail.") + # Does the health status report reflect the corruption? + if [ $res -ne 0 ]; then + __fuzz_notify "++ Detect fuzzed field ill-health report" + _check_xfs_health $SCRATCH_MNT 2>&1 + res=$? + test $res -ne 1 && \ + (>&2 echo "${fuzz_action}: online health check failed ($res).") + fi + # Try fixing the filesystem online __fuzz_notify "++ Try to repair filesystem (online)" _scratch_scrub 2>&1 diff --git a/common/xfs b/common/xfs index 804047557b..371618dc7b 100644 --- a/common/xfs +++ b/common/xfs @@ -599,6 +599,37 @@ _require_xfs_db_command() _notrun "xfs_db $command support is missing" } +# Check the health of a mounted XFS filesystem. Callers probably want to +# ensure that xfs_scrub has been run first. Returns 1 if unhealthy metadata +# are found or 0 otherwise. +_check_xfs_health() { + local mntpt="$1" + local ret=0 + local t="$tmp.health_helper" + + test -x "$XFS_SPACEMAN_PROG" || return 0 + + $XFS_SPACEMAN_PROG -c 'health -c -q' $mntpt > $t.out 2> $t.err + test $? -ne 0 && ret=1 + + # Don't return error if userspace or kernel don't support health + # reporting. + grep -q 'command.*health.*not found' $t.err && return 0 + grep -q 'Inappropriate ioctl for device' $t.err && return 0 + + # Filter out the "please run scrub" message if nothing's been checked. + sed -e '/Health status has not been/d' -e '/Please run xfs_scrub/d' -i \ + $t.err + + grep -q unhealthy $t.out && ret=1 + test $(wc -l < $t.err) -gt 0 && ret=1 + cat $t.out + cat $t.err 1>&2 + rm -f $t.out $t.err + + return $ret +} + # Does the filesystem mounted from a particular device support scrub? _supports_xfs_scrub() { @@ -750,6 +781,18 @@ _check_xfs_filesystem() ok=0 fi rm -f $tmp.scrub + + # Does the health reporting notice anything? + _check_xfs_health $mntpt > $tmp.health 2>&1 + res=$? + if [ $((res ^ ok)) -eq 0 ]; then + _log_err "_check_xfs_filesystem: filesystem on $device failed health check" + echo "*** xfs_spaceman -c 'health -c -q' output ***" >> $seqres.full + cat $tmp.health >> $seqres.full + echo "*** end xfs_spaceman output" >> $seqres.full + ok=0 + fi + rm -f $tmp.health fi if [ "$type" = "xfs" ]; then From patchwork Fri Dec 30 22:19:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085248 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5CA8C3DA7C for ; Sat, 31 Dec 2022 00:49:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235953AbiLaAtG (ORCPT ); Fri, 30 Dec 2022 19:49:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235926AbiLaAtF (ORCPT ); Fri, 30 Dec 2022 19:49:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA1621C90A; Fri, 30 Dec 2022 16:49:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4610C61D5F; Sat, 31 Dec 2022 00:49:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6183C433D2; Sat, 31 Dec 2022 00:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447743; bh=KzbmAxwxCO5ZCO5hNbka+HNvJXhlESdLL3ljiFmQYUU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Ni4lxEFo68lh6rbBAaW2QLyRXPnDPzRgEdIL21GuGDpcBAXOR3Q0UPdRcvUuX8aVV Nv4tJkm899cpc8aoYHQLnX+iPQPC1KrBdlQ8pexFWfEpHACJOIwwz1SZVzHBhb+Tqv elcYQ0KyB/t78vyF1tNVTMXls/AtargXJK8WMtAcmZaYkvyoJ86y8xuiJT3bGWGfRG AaqtncKXnmr5f2K5io08cBsBSzTDjrk81S0y5Zl3zUrhAQrKEBdGa11DQsLc5qWgQy 77AG0WKiv2h71rFmlct1VjA0HsjcJlBDzxnWLWL+4Pp+3jUv9UUAVuO/1Q7N7XBmnI nyLLzQGC1np9g== Subject: [PATCH 19/24] common/fuzzy: exercise the filesystem a little harder after repairing From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:41 -0800 Message-ID: <167243878151.730387.10482590570304640293.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Use fsstress to exercise the filesystem a little more strenuously after we've run the fuzzing repair strategy, so that we have a better chance of tripping over corruption problems. Signed-off-by: Darrick J. Wong --- common/fuzzy | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index d841d435eb..3de6f43dc6 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -6,30 +6,18 @@ # Modify various files after a fuzzing operation _scratch_fuzz_modify() { - nr="$1" + echo "+++ stressing filesystem" + mkdir -p $SCRATCH_MNT/data + _xfs_force_bdev data $SCRATCH_MNT/data + $FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/data - test -z "${nr}" && nr=50000 - echo "+++ touch ${nr} files" - blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT}) - $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null - date="$(date)" - find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do - # try to remove append, immutable (and even dax) flag if exists - $XFS_IO_PROG -rc 'chattr -x -i -a' "$f" > /dev/null 2>&1 - setfattr -n "user.date" -v "${date}" "$f" - cat "/tmp/afile" >> "$f" - mv "$f" "$f.longer" - done - sync - rm -rf "/tmp/afile" - - echo "+++ create files" - mkdir -p "${SCRATCH_MNT}/test.moo" - $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk" > /dev/null - sync - - echo "+++ remove files" - rm -rf "${SCRATCH_MNT}/test.moo" + if _xfs_has_feature "$SCRATCH_MNT" realtime; then + mkdir -p $SCRATCH_MNT/rt + _xfs_force_bdev realtime $SCRATCH_MNT/rt + $FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/rt + else + echo "+++ xfs realtime not configured" + fi } # Try to access files after fuzzing @@ -429,7 +417,7 @@ _scratch_xfs_fuzz_field_modifyfs() { # Try modifying the filesystem again __fuzz_notify "++ Try to write filesystem again" - _scratch_fuzz_modify 100 2>&1 + _scratch_fuzz_modify 2>&1 # If we didn't repair anything, there's no point in checking further, # the fs is still corrupt. From patchwork Fri Dec 30 22:19:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085249 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB63CC4332F for ; Sat, 31 Dec 2022 00:49:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235956AbiLaAtX (ORCPT ); Fri, 30 Dec 2022 19:49:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235926AbiLaAtW (ORCPT ); Fri, 30 Dec 2022 19:49:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C662D1C90A; Fri, 30 Dec 2022 16:49:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 78EE4B81DF1; Sat, 31 Dec 2022 00:49:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35D2BC433D2; Sat, 31 Dec 2022 00:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447759; bh=XH1DysJORpOtUFE+x7fJQw8bzUSsfmgCq3QqNexVkKU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=sEaD3ulI66RRW7KWBPRMxn3eOL7HJuZ1lM+ILxTqATXfCMhYBFOw00Y/uAZpZHEcT f0nsXOGZbd4yLsNnl6LVIL8ItMGrRpU0L75C7RqpanVPZ0OxtNhr/PVnuUo3q+L2Ij fHRhaX6heZZykD5sSgEueXSb61eHV+JZKB6arur2xwJ1OkcCfvffZht5aZ9VyXnCj1 xi+V9oJJgmz2zYXnqv7qWhE9cS2KUCqVDFUrGcM59UJzBuITIqLFBPyOgtJ5EV0gmx 7O2CC7saMd8szWLb3uO0tAnNmk3neLe9aocKuvxt8wLNasSZUPt6EtxuPlGe/t3GIq D5/0CH3QOm7/w== Subject: [PATCH 20/24] fuzzy: dump metadata state before fuzzing From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:41 -0800 Message-ID: <167243878162.730387.16597687752166658725.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong When we start a fuzz test, dump the metadata to stdout so that anyone analyzing a failure can see what was in the (supposedly) good image, and what it turns into after fuzzing. Signed-off-by: Darrick J. Wong --- common/fuzzy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/fuzzy b/common/fuzzy index 3de6f43dc6..939f5e5ef2 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -110,6 +110,16 @@ __filter_xfs_db_print_fields() { done | grep -E "${filter}" | __filter_unvalidated_xfs_db_fields } +# Dump the current contents of a metadata object. +# All arguments are xfs_db commands to locate the metadata. +_scratch_xfs_dump_metadata() { + local cmds=() + for arg in "$@"; do + cmds+=("-c" "${arg}") + done + _scratch_xfs_db "${cmds[@]}" -c print +} + # Navigate to some part of the filesystem and print the field info. # The first argument is an grep filter for the fields # The rest of the arguments are xfs_db commands to locate the metadata. @@ -534,6 +544,8 @@ _scratch_xfs_fuzz_metadata() { echo $(echo "${fields}") echo "Verbs we propose to fuzz with:" echo $(echo "${verbs}") + echo "Current metadata object state:" + _scratch_xfs_dump_metadata "$@" # Always capture full core dumps from crashing tools ulimit -c unlimited From patchwork Fri Dec 30 22:19:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085250 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FE6DC4332F for ; Sat, 31 Dec 2022 00:49:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235959AbiLaAth (ORCPT ); Fri, 30 Dec 2022 19:49:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235926AbiLaAtg (ORCPT ); Fri, 30 Dec 2022 19:49:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA3071C90A; Fri, 30 Dec 2022 16:49:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 64A4061D62; Sat, 31 Dec 2022 00:49:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE3BBC433D2; Sat, 31 Dec 2022 00:49:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447774; bh=EGOSjDBjojcDX/0QFWZrdfMrZPsEkrHx+pjvzqnebdk=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=LlxRXHG1dfYa9edrVP37mImfvLVspvtWO9CTSi7jxp03SGu++WWZS/sWS5FleVVDp 6hcC/6mRfNN4bCzMs6JCOYf0kjnkF1tvHZHC7mWJSmzHEmj1SL9aKuDkW7IIJxtqIo y1p4PwLB8PuB9HQCA6bmpaLl0BQU3HRUJG+TIQkCnUPPuoG6zlrvNrPwJiBrnNpPj7 8UaN/X6FnMHTX5rLTcBKSeCsWP9lW4n/OUYupDzwrLEya8NKfrGospaTo6c6jHWuau ZLqc42HpGXRprx1Ref1JxhalS19Ml5uqwoabAEO14qu6YwYEr071AQJAhdYfOUZlEa 8OUYjD38fbWsA== Subject: [PATCH 21/24] fuzzy: compress coredumps created while fuzzing From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:41 -0800 Message-ID: <167243878174.730387.1210805783525611354.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Compress the coredumps and put them in the results directory. Signed-off-by: Darrick J. Wong --- common/fuzzy | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/fuzzy b/common/fuzzy index 939f5e5ef2..7eaf883c0f 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -554,6 +554,14 @@ _scratch_xfs_fuzz_metadata() { echo "${verbs}" | while read fuzzverb; do __scratch_xfs_fuzz_mdrestore __scratch_xfs_fuzz_field_test "${field}" "${fuzzverb}" "${repair}" "$@" + + # Collect compresssed coredumps in the test results + # directory if the sysadmin didn't override the default + # coredump strategy. + for i in core core.*; do + test -f "$i" || continue + _save_coredump "$i" + done done done } From patchwork Fri Dec 30 22:19:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085251 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61970C4332F for ; Sat, 31 Dec 2022 00:49:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235926AbiLaAtw (ORCPT ); Fri, 30 Dec 2022 19:49:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235961AbiLaAtw (ORCPT ); Fri, 30 Dec 2022 19:49:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 595D11DDF3; Fri, 30 Dec 2022 16:49:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EB29C61D62; Sat, 31 Dec 2022 00:49:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53B51C433EF; Sat, 31 Dec 2022 00:49:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447790; bh=pWI/7gx+/2hlyL1T3qHgE+gsGHJ43Hifpc1+LEFASJw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=OeBZ55SgHWU114gQz4fdJ7YclGzggnI7T6lbFAqqENhpKsLW6mbMpN3v1tByswENy Rh8f2E4K6iterdh0+9klFVbAKryTaHO+m35gNNaU7glIw84M8EHPL/1NOKZgjCUavI h8ij+wMKUtFBA8ZiDKfbNL5mPk09+yrdflaFWyKXElF8I2a5g6IyXJTNu3sk8VsNdV 7UUx+Uf6LVMyrW1qZwOpREFckxIZXt98X1RiNIcmiSNVdQLhvpKOR2+2kHgW144VPd gDRkCii1Cn6lbicU93rIfcuYQpX7id9DWNlu8BHuI9dcpSHdFDJSvK1WComneVMrTn rG/psKsJBKRGg== Subject: [PATCH 22/24] fuzzy: report the fuzzing repair strategy in seqres.full From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:41 -0800 Message-ID: <167243878185.730387.13872846406219490291.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Record in the seqres.full file the filesystem repair strategy that we're going to use to detect the fuzzed metadata. Signed-off-by: Darrick J. Wong --- common/fuzzy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/fuzzy b/common/fuzzy index 7eaf883c0f..f34fcadefe 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -540,7 +540,7 @@ _scratch_xfs_fuzz_metadata() { fields="$(_scratch_xfs_list_metadata_fields "${filter}" "$@")" verbs="$(_scratch_xfs_list_fuzz_verbs)" - echo "Fields we propose to fuzz under: $@" + echo "Fields we propose to fuzz with the \"${repair}\" repair strategy: $@" echo $(echo "${fields}") echo "Verbs we propose to fuzz with:" echo $(echo "${verbs}") From patchwork Fri Dec 30 22:19:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4977C4332F for ; Sat, 31 Dec 2022 00:50:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235963AbiLaAuK (ORCPT ); Fri, 30 Dec 2022 19:50:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235961AbiLaAuK (ORCPT ); Fri, 30 Dec 2022 19:50:10 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 380F91C90A; Fri, 30 Dec 2022 16:50:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9D19ECE19DE; Sat, 31 Dec 2022 00:50:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA8C9C433D2; Sat, 31 Dec 2022 00:50:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447805; bh=LReZUtiiLtA24sAwo5AE7gGUUPGAkzXUG2q0DJXRAPA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=qHuCvGPLuAVCU37R34JWKtjKsJT6TOvjLcnmnnabM3aguvJzpA+GjoGv4SuWvh+cg n5H+bHw0tmrhl2FsbCU0XYkIu9wAziVtxoU2RWjHjg+epkMnJ+2/JpmwqO4VoaMl6S rI6B5R8we/AmmtZHJF+MaP6cm/ElEtGcM8ptCb/2OkdfG3U4KdnL5TyzGn9/uu67L8 4MgOZDA0AF+xWEG+ycvWYdA6LFTFLyoyWPhmIXOfST3FEmfDY9iGP7Zu1h7ARpt/2N ndZQnDbO64NRHa+EensWUYbRQvmoextpsXbG9h96axhPDYfBK9K8P41sfAI7ZHaDpA yohJ6qdXiEPCg== Subject: [PATCH 23/24] xfs: improve metadata array field handling when fuzzing From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:42 -0800 Message-ID: <167243878198.730387.15283951286419535093.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong Currently, we use some gnarly regular expressions to try to constrain the amount of time we spend fuzzing each element of a metadata array. This is pretty inflexible (and buggy) since we limit some arrays (e.g. dir hashes) to the first ten elements and other arrays (e.g. extent mappings) that use compact index ranges to the first one. Replace this whole weird mess with logic that can tease out the array indices, unroll the compact indices if needed, and give the user more flexible control over which array elements get used. Signed-off-by: Darrick J. Wong --- common/fuzzy | 52 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index f34fcadefe..53fe22db69 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -53,12 +53,46 @@ _scratch_scrub() { esac } -# Filter out any keys with an array index >= 10, collapse any array range -# ("[1-195]") to the first item, and ignore padding fields. -__filter_xfs_db_keys() { - sed -e '/\([a-z]*\)\[\([0-9][0-9]\+\)\].*/d' \ - -e 's/\([a-zA-Z0-9_]*\)\[\([0-9]*\)-[0-9]*\]/\1[\2]/g' \ - -e '/pad/d' +# Expand indexed keys (i.e. arrays) into a long format so that we can filter +# the array indices individually, and pass regular keys right through. +# +# For example, "u3.bmx[0-1] = [foo,bar]" is exploded into: +# u3.bmx[0] = [foo,bar] +# u3.bmx[1] = [foo,bar] +# +# Note that we restrict array indices to [0-9] to reduce fuzz runtime. The +# minimum and maximum array indices can be changed by setting the variables +# SCRATCH_XFS_{MIN,MAX}_ARRAY_IDX. +# +# Also filter padding fields. +__explode_xfs_db_fields() { + local min_idx="${SCRATCH_XFS_MIN_ARRAY_IDX}" + local max_idx="${SCRATCH_XFS_MAX_ARRAY_IDX}" + + test -z "${min_idx}" && min_idx=0 + test -z "${max_idx}" && max_idx=9 + test "${max_idx}" = "none" && max_idx=99999 + + grep ' = ' | \ + sed -e 's/^\([.a-zA-Z0-9_]*\)\[\([0-9]*\)-\([0-9]*\)\]\(.*\) = \(.*\)$/\1[%d]\4 \2 \3 = \5/g' \ + -e 's/^\([.a-zA-Z0-9_]*\)\[\([0-9]*\)\]\(.*\) = \(.*\)$/\1[%d]\3 \2 \2 = \4/g' | \ + while read name col1 col2 rest; do + if [[ "${name}" == *pad* ]]; then + continue + fi + + if [ "${col1}" = "=" ]; then + echo "${name} ${col1} ${col2} ${rest}" + continue + fi + + test "${min_idx}" -gt "${col1}" && col1="${min_idx}" + test "${max_idx}" -lt "${col2}" && col2="${max_idx}" + + seq "${col1}" "${col2}" | while read idx; do + printf "${name} %s\n" "${idx}" "${rest}" + done + done } # Filter out metadata fields that are completely controlled by userspace @@ -96,14 +130,14 @@ __filter_xfs_db_print_fields() { if [ -z "${filter}" ] || [ "${filter}" = "nofilter" ]; then filter='^' fi - grep ' = ' | while read key equals value; do - fuzzkey="$(echo "${key}" | __filter_xfs_db_keys)" + __explode_xfs_db_fields | while read key equals value; do + fuzzkey="$(echo "${key}")" if [ -z "${fuzzkey}" ]; then continue elif [[ "${value}" == "["* ]]; then echo "${value}" | sed -e 's/^.//g' -e 's/.$//g' -e 's/,/\n/g' | while read subfield; do echo "${fuzzkey}.${subfield}" - done | __filter_xfs_db_keys + done else echo "${fuzzkey}" fi From patchwork Fri Dec 30 22:19:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085253 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1E8FC3DA7D for ; Sat, 31 Dec 2022 00:50:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235965AbiLaAu0 (ORCPT ); Fri, 30 Dec 2022 19:50:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235961AbiLaAu0 (ORCPT ); Fri, 30 Dec 2022 19:50:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 508521C90A; Fri, 30 Dec 2022 16:50:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CCE9EB81DF1; Sat, 31 Dec 2022 00:50:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8705FC433EF; Sat, 31 Dec 2022 00:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447821; bh=7qF8prR8cdmJPChy8VnI2i2RPMsH7gWhmnpQjimVnAc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=HVwz79V59fld7R3oh8bteazVWjwssvm3PU3QDYy5ePwUNqRtPyCf4BQy4bYjytVJ8 36K8t+RHDk0F1Z+odbAdfBCBEF8Z85rF0rDSlkeI3cPBNt53DncdiJgH4YKNb+k3AQ 0hDK8qpFuaL9M7LMpVqDyvzZm92Jtq1StGIb+qG/pnoNss/GSHPDVhFdhZVe273kl6 vH03HC8oOzq/TF11jTO5aCf/e0jsaK/kGgkNxRUqOuFfHlFxrx5dd+fOVFmGJolLj4 8pXiC9gMjtbHbXFCMmHxp4AJbvnTWkJ3kqlLxMRL3IvfQDA+rDanJZrmFt7qYweWFy fSZoHBDrgqgWA== Subject: [PATCH 24/24] fuzzy: for fuzzing ag btrees, find the path to the AG header From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:19:42 -0800 Message-ID: <167243878211.730387.7658682202200874885.stgit@magnolia> In-Reply-To: <167243877899.730387.9276624623424433346.stgit@magnolia> References: <167243877899.730387.9276624623424433346.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Darrick J. Wong The fs population code creates various btrees in /some/ allocation group with at least two levels. These btrees aren't necessarily created in agno 0, so we need to find it programmatically. While we're at it, fix a few of the comments that failed to mention when we're fuzzing interior nodes and not leaves. Signed-off-by: Darrick J. Wong --- common/xfs | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/358 | 5 ++++- tests/xfs/359 | 5 ++++- tests/xfs/360 | 5 ++++- tests/xfs/361 | 5 ++++- tests/xfs/362 | 5 ++++- tests/xfs/363 | 5 ++++- tests/xfs/364 | 5 ++++- tests/xfs/365 | 5 ++++- tests/xfs/366 | 5 ++++- tests/xfs/367 | 5 ++++- tests/xfs/368 | 5 ++++- tests/xfs/369 | 5 ++++- tests/xfs/370 | 5 ++++- tests/xfs/371 | 5 ++++- tests/xfs/372 | 5 ++++- tests/xfs/373 | 7 +++++-- tests/xfs/410 | 5 ++++- tests/xfs/411 | 5 ++++- tests/xfs/457 | 5 ++++- tests/xfs/458 | 5 ++++- tests/xfs/459 | 5 ++++- tests/xfs/460 | 5 ++++- tests/xfs/461 | 5 ++++- tests/xfs/462 | 5 ++++- tests/xfs/463 | 5 ++++- tests/xfs/464 | 7 +++++-- tests/xfs/483 | 5 ++++- 28 files changed, 147 insertions(+), 29 deletions(-) diff --git a/common/xfs b/common/xfs index 371618dc7b..610730e5ef 100644 --- a/common/xfs +++ b/common/xfs @@ -1686,3 +1686,40 @@ _xfs_get_inode_core_bytes() echo 96 fi } + +# Find us the path to the AG header containing a per-AG btree with a specific +# height. +_scratch_xfs_find_agbtree_height() { + local bt_type="$1" + local bt_height="$2" + local agcount=$(_xfs_mount_agcount $SCRATCH_DEV) + + case "${bt_type}" in + "bno"|"cnt"|"rmap"|"refcnt") + hdr="agf" + bt_prefix="${bt_type}" + ;; + "ino") + hdr="agi" + bt_prefix="" + ;; + "fino") + hdr="agi" + bt_prefix="free_" + ;; + *) + _fail "Don't know about AG btree ${bt_type}" + ;; + esac + + for ((agno = 0; agno < agcount; agno++)); do + bt_level=$(_scratch_xfs_db -c "${hdr} ${agno}" -c "p ${bt_prefix}level" | awk '{print $3}') + # "level" is really the btree height + if [ "${bt_level}" -eq "${bt_height}" ]; then + echo "${hdr} ${agno}" + return 0 + fi + done + + return 1 +} diff --git a/tests/xfs/358 b/tests/xfs/358 index a00eb6f9cb..92180e5196 100755 --- a/tests/xfs/358 +++ b/tests/xfs/358 @@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \ + _fail "could not find two-level bnobt" + echo "Fuzz bnobt recs" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing bnobt recs" # success, all done diff --git a/tests/xfs/359 b/tests/xfs/359 index f0a82db4b8..0498aaccf5 100755 --- a/tests/xfs/359 +++ b/tests/xfs/359 @@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \ + _fail "could not find two-level bnobt" + echo "Fuzz bnobt recs" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing bnobt recs" # success, all done diff --git a/tests/xfs/360 b/tests/xfs/360 index 3942ffd1b2..c34f455403 100755 --- a/tests/xfs/360 +++ b/tests/xfs/360 @@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \ + _fail "could not find two-level bnobt" + echo "Fuzz bnobt keyptr" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr bnoroot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr bnoroot' >> $seqres.full echo "Done fuzzing bnobt keyptr" # success, all done diff --git a/tests/xfs/361 b/tests/xfs/361 index b7ee0f6f94..22b1af4ea3 100755 --- a/tests/xfs/361 +++ b/tests/xfs/361 @@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \ + _fail "could not find two-level bnobt" + echo "Fuzz bnobt keyptr" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr bnoroot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr bnoroot' >> $seqres.full echo "Done fuzzing bnobt keyptr" # success, all done diff --git a/tests/xfs/362 b/tests/xfs/362 index f711661b02..51727edc06 100755 --- a/tests/xfs/362 +++ b/tests/xfs/362 @@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'cnt' 2)" || \ + _fail "could not find two-level cntbt" + echo "Fuzz cntbt" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr cntroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr cntroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing cntbt" # success, all done diff --git a/tests/xfs/363 b/tests/xfs/363 index 6be9109eca..8a62c1c821 100755 --- a/tests/xfs/363 +++ b/tests/xfs/363 @@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'cnt' 2)" || \ + _fail "could not find two-level cntbt" + echo "Fuzz cntbt" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr cntroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr cntroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing cntbt" # success, all done diff --git a/tests/xfs/364 b/tests/xfs/364 index fcd18fe686..984ecdafed 100755 --- a/tests/xfs/364 +++ b/tests/xfs/364 @@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'ino' 2)" || \ + _fail "could not find two-level inobt" + echo "Fuzz inobt" -_scratch_xfs_fuzz_metadata '' 'offline' 'agi 0' 'addr root' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr root' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing inobt" # success, all done diff --git a/tests/xfs/365 b/tests/xfs/365 index 6f116f9b9c..e4325c35d1 100755 --- a/tests/xfs/365 +++ b/tests/xfs/365 @@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'ino' 2)" || \ + _fail "could not find two-level inobt" + echo "Fuzz inobt" -_scratch_xfs_fuzz_metadata '' 'online' 'agi 1' 'addr root' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr root' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing inobt" # success, all done diff --git a/tests/xfs/366 b/tests/xfs/366 index 4c651288c0..8a52d21a0f 100755 --- a/tests/xfs/366 +++ b/tests/xfs/366 @@ -25,8 +25,11 @@ _require_xfs_finobt echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'fino' 2)" || \ + _fail "could not find two-level finobt" + echo "Fuzz finobt" -_scratch_xfs_fuzz_metadata '' 'offline' 'agi 0' 'addr free_root' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr free_root' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing finobt" # success, all done diff --git a/tests/xfs/367 b/tests/xfs/367 index c474a9e7d8..d9d07faab2 100755 --- a/tests/xfs/367 +++ b/tests/xfs/367 @@ -25,8 +25,11 @@ _require_xfs_finobt echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'fino' 2)" || \ + _fail "could not find two-level finobt" + echo "Fuzz finobt" -_scratch_xfs_fuzz_metadata '' 'online' 'agi 0' 'addr free_root' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr free_root' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing finobt" # success, all done diff --git a/tests/xfs/368 b/tests/xfs/368 index b1c1f97664..83499827c9 100755 --- a/tests/xfs/368 +++ b/tests/xfs/368 @@ -25,8 +25,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rmapbt" + echo "Fuzz rmapbt recs" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing rmapbt recs" # success, all done diff --git a/tests/xfs/369 b/tests/xfs/369 index 5e6d8d9be0..3236b50e00 100755 --- a/tests/xfs/369 +++ b/tests/xfs/369 @@ -25,8 +25,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rmapbt" + echo "Fuzz rmapbt recs" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing rmapbt recs" # success, all done diff --git a/tests/xfs/370 b/tests/xfs/370 index 0a916242e2..891d5e2572 100755 --- a/tests/xfs/370 +++ b/tests/xfs/370 @@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rmapbt" + echo "Fuzz rmapbt keyptr" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr rmaproot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr rmaproot' >> $seqres.full echo "Done fuzzing rmapbt keyptr" # success, all done diff --git a/tests/xfs/371 b/tests/xfs/371 index a9b914d9f5..f7a336b170 100755 --- a/tests/xfs/371 +++ b/tests/xfs/371 @@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rmapbt" + echo "Fuzz rmapbt keyptr" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr rmaproot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr rmaproot' >> $seqres.full echo "Done fuzzing rmapbt keyptr" # success, all done diff --git a/tests/xfs/372 b/tests/xfs/372 index c39a917500..2250322527 100755 --- a/tests/xfs/372 +++ b/tests/xfs/372 @@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \ + _fail "could not find two-level refcountbt" + echo "Fuzz refcountbt" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr refcntroot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr refcntroot' >> $seqres.full echo "Done fuzzing refcountbt" # success, all done diff --git a/tests/xfs/373 b/tests/xfs/373 index 324aa9fe7d..e0c20044ec 100755 --- a/tests/xfs/373 +++ b/tests/xfs/373 @@ -4,7 +4,7 @@ # # FS QA Test No. 373 # -# Populate a XFS filesystem and fuzz every refcountbt field. +# Populate a XFS filesystem and fuzz every refcountbt key/pointer field. # Use xfs_scrub to fix the corruption. # . ./common/preamble @@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \ + _fail "could not find two-level refcountbt" + echo "Fuzz refcountbt" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr refcntroot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr refcntroot' >> $seqres.full echo "Done fuzzing refcountbt" # success, all done diff --git a/tests/xfs/410 b/tests/xfs/410 index e98a63ebf5..388ed7d190 100755 --- a/tests/xfs/410 +++ b/tests/xfs/410 @@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \ + _fail "could not find two-level refcountbt" + echo "Fuzz refcountbt" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing refcountbt" # success, all done diff --git a/tests/xfs/411 b/tests/xfs/411 index cfe7796102..a9fc25ce7d 100755 --- a/tests/xfs/411 +++ b/tests/xfs/411 @@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \ + _fail "could not find two-level refcountbt" + echo "Fuzz refcountbt" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing refcountbt" # success, all done diff --git a/tests/xfs/457 b/tests/xfs/457 index 332eeb9837..64cd6b4b82 100755 --- a/tests/xfs/457 +++ b/tests/xfs/457 @@ -25,8 +25,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \ + _fail "could not find two-level bnobt" + echo "Fuzz bnobt recs" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing bnobt recs" # success, all done diff --git a/tests/xfs/458 b/tests/xfs/458 index ce03d687ab..8d87ec569f 100755 --- a/tests/xfs/458 +++ b/tests/xfs/458 @@ -25,8 +25,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \ + _fail "could not find two-level bnobt" + echo "Fuzz bnobt keyptr" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr bnoroot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr bnoroot' >> $seqres.full echo "Done fuzzing bnobt keyptr" # success, all done diff --git a/tests/xfs/459 b/tests/xfs/459 index d166160f87..5989bc1e6e 100755 --- a/tests/xfs/459 +++ b/tests/xfs/459 @@ -25,8 +25,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'cnt' 2)" || \ + _fail "could not find two-level cntbt" + echo "Fuzz cntbt" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr cntroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr cntroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing cntbt" # success, all done diff --git a/tests/xfs/460 b/tests/xfs/460 index 0daafa3066..7117477011 100755 --- a/tests/xfs/460 +++ b/tests/xfs/460 @@ -25,8 +25,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'ino' 2)" || \ + _fail "could not find two-level inobt" + echo "Fuzz inobt" -_scratch_xfs_fuzz_metadata '' 'none' 'agi 1' 'addr root' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr root' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing inobt" # success, all done diff --git a/tests/xfs/461 b/tests/xfs/461 index 2d20c69d87..7c1327b052 100755 --- a/tests/xfs/461 +++ b/tests/xfs/461 @@ -26,8 +26,11 @@ _require_xfs_finobt echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'fino' 2)" || \ + _fail "could not find two-level finobt" + echo "Fuzz finobt" -_scratch_xfs_fuzz_metadata '' 'none' 'agi 0' 'addr free_root' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr free_root' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing finobt" # success, all done diff --git a/tests/xfs/462 b/tests/xfs/462 index 587facc03c..1ee4d27e92 100755 --- a/tests/xfs/462 +++ b/tests/xfs/462 @@ -26,8 +26,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rmapbt" + echo "Fuzz rmapbt recs" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing rmapbt recs" # success, all done diff --git a/tests/xfs/463 b/tests/xfs/463 index 7270f7017a..7dd2d37dea 100755 --- a/tests/xfs/463 +++ b/tests/xfs/463 @@ -26,8 +26,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rmapbt" + echo "Fuzz rmapbt keyptr" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr rmaproot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr rmaproot' >> $seqres.full echo "Done fuzzing rmapbt keyptr" # success, all done diff --git a/tests/xfs/464 b/tests/xfs/464 index 59d25ae1c0..719901e66d 100755 --- a/tests/xfs/464 +++ b/tests/xfs/464 @@ -4,7 +4,7 @@ # # FS QA Test No. 464 # -# Populate a XFS filesystem and fuzz every refcountbt field. +# Populate a XFS filesystem and fuzz every refcountbt key/pointer field. # Do not fix the filesystem, to test metadata verifiers. . ./common/preamble @@ -27,8 +27,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \ + _fail "could not find two-level refcountbt" + echo "Fuzz refcountbt" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr refcntroot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr refcntroot' >> $seqres.full echo "Done fuzzing refcountbt" # success, all done diff --git a/tests/xfs/483 b/tests/xfs/483 index d7b0101a82..56670ba178 100755 --- a/tests/xfs/483 +++ b/tests/xfs/483 @@ -27,8 +27,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \ + _fail "could not find two-level refcountbt" + echo "Fuzz refcountbt" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing refcountbt" # success, all done