Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp379852imn; Mon, 25 Jul 2022 20:14:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sIuSuFIRCf8IThXFB7OimbEPq1hl76o0LN2N6gjCm5fBE5LWY7nUAX7xUDwa6vEennl009 X-Received: by 2002:a63:31d3:0:b0:412:a9d9:d407 with SMTP id x202-20020a6331d3000000b00412a9d9d407mr13390678pgx.479.1658805296328; Mon, 25 Jul 2022 20:14:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658805296; cv=none; d=google.com; s=arc-20160816; b=tYx+TUOxKqdNwxWiIBbkIFyZDH/P1iyFbIoL5qOE1MmDPnD8vwuGgaFhwNzaQ2adA+ 5dMuV8cBHn6t498wTod4skyY6RAO6hkOmrvFMUvDgNHEDeQVQlK3JBTkXxIdQEkZUeUb 2/Ba5e+eHHpfpA+imR2fwsDUUpjQhiN6FyAKWwkBaF4taU1W/pvRgIyMCF5mWCY8E2OE 5/JoW1LmAhrVrF9nxTRK+Ps09rnBw30RggVgekD1o05abyJksgopHr5Gi0IfY8di69oV msFG3zTX9vj+fw90RiE9eyn6Ep9ornRdUASfM++8Qb+LzgU2T35aWJK+UwLJOBXs7Fxt sHjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=3iSsTmq7C7kGUONZQDPmzlBmDKQpQ/N65Zm9NAuYfHQ=; b=uuW6d2wWefjkyNhkU04f0pZ2xnaLD3aD7v3YANy9vVmRnJF5f8Dt9gpyswEFX6Lidx QXZZcM7Y3p7h+nbtEn2R2IlXJfDc9KQ04Ul8CmGof99Oq+lLBQcRLQyd0v9wHA00XcL9 1KhyE49h/O2jOMXr1PrNb+dSQSM/hun/LYntrttCmqcy8eXwsybc+OkI5IaDF0TcOxkG cWBbqoNUj6Vhjxy7KSMAyxCJ2uj9cIqnKjCXl0wyhAWIGweZ5W1jMPQB+rA2iX5UUb8D dQeApN7aPSbLxImqYWXwG3RHutpQhpagXQOrkr0l1FicACYNQdEJV95VR9g2xwtAuYs/ /3Ew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b2-20020a170902d50200b0016c70e14b13si18476017plg.539.2022.07.25.20.14.35; Mon, 25 Jul 2022 20:14:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231616AbiGZDKu (ORCPT + 99 others); Mon, 25 Jul 2022 23:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230433AbiGZDKt (ORCPT ); Mon, 25 Jul 2022 23:10:49 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFD21220D5; Mon, 25 Jul 2022 20:10:48 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LsMJX3S7fzWfFv; Tue, 26 Jul 2022 11:06:52 +0800 (CST) Received: from kwepemm600010.china.huawei.com (7.193.23.86) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 26 Jul 2022 11:10:34 +0800 Received: from huawei.com (10.175.127.227) by kwepemm600010.china.huawei.com (7.193.23.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 26 Jul 2022 11:10:33 +0800 From: Sun Ke To: CC: , , Subject: [PATCH v4] ext4: resize fs after set reserved GDT blocks equals 100 Date: Tue, 26 Jul 2022 11:22:40 +0800 Message-ID: <20220726032240.3709879-1-sunke32@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600010.china.huawei.com (7.193.23.86) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Set reserved GDT blocks equals 100, then resize fs, will trigger null pointer. Regression test for commit b55c3cd102a6 ext4: add reserved GDT blocks check. Signed-off-by: Sun Ke --- tests/ext4/057 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tests/ext4/057.out | 2 ++ 2 files changed, 48 insertions(+) create mode 100755 tests/ext4/057 create mode 100644 tests/ext4/057.out diff --git a/tests/ext4/057 b/tests/ext4/057 new file mode 100755 index 00000000..f4bbcd32 --- /dev/null +++ b/tests/ext4/057 @@ -0,0 +1,46 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 HUAWEI. All Rights Reserved. +# +# FS QA Test 057 +# +# Set reserved GDT blocks equals 100, then resize fs, will trigger null pointer. +# +# Regression test for commit +# b55c3cd102a6 ext4: add reserved GDT blocks check +# +. ./common/preamble +_begin_fstest auto resize quick + +# real QA test starts here + +# Modify as appropriate. +_supported_fs ext4 +_fixed_by_kernel_commit b55c3cd102a6 \ + "ext4: add reserved GDT blocks check" + +_require_command "$TUNE2FS_PROG" tune2fs +_require_command "$RESIZE2FS_PROG" resize2fs +_require_command "$DEBUGFS_PROG" debugfs +_require_scratch_size $((1024 * 1024)) #kB +_require_scratch_nocheck + +# set fs size 512M +dev_size=$((512 * 1024 * 1024)) +MKFS_OPTIONS="-O ^resize_inode $MKFS_OPTIONS" _scratch_mkfs_sized $dev_size \ + >>$seqres.full 2>&1 || _fail "mkfs failed" + +$DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 100" $SCRATCH_DEV \ + >>$seqres.full 2>&1 + +$DEBUGFS_PROG -R "show_super_stats -h" $SCRATCH_DEV 2>/dev/null | \ + grep "Reserved GDT blocks" + +_scratch_mount + +# resize fs will trigger NULL pointer in ext4_flex_group_add +$RESIZE2FS_PROG $SCRATCH_DEV 1G >> $seqres.full 2>&1 + +# success, all done +status=0 +exit diff --git a/tests/ext4/057.out b/tests/ext4/057.out new file mode 100644 index 00000000..99423e16 --- /dev/null +++ b/tests/ext4/057.out @@ -0,0 +1,2 @@ +QA output created by 057 +Reserved GDT blocks: 100 -- 2.13.6