ext4/027: Correct the right code of block and inode bitmap
[xfstests-dev.git] / tests / ext4 / 025
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Fujitsu.  All Rights Reserved.
4 #
5 # FS QA Test ext4/025
6 #
7 # Regression test for commit:
8 # 3a4b77c ("ext4: validate s_first_meta_bg at mount time").
9 #
10 . ./common/preamble
11 _begin_fstest auto quick fuzzers dangerous
12
13 # get standard environment and checks
14 . ./common/filter
15
16 # real QA test starts here
17 _supported_fs ext4
18 _require_scratch_nocheck
19 _require_command "$DEBUGFS_PROG" debugfs
20 _require_scratch_ext4_feature "bigalloc,meta_bg,^resize_inode"
21
22 echo "Create ext4 fs and modify first_meta_bg's value"
23 _scratch_mkfs "-O bigalloc,meta_bg,^resize_inode" >> $seqres.full 2>&1
24
25 # set a big enough first_meta_bg to trigger buffer overrun
26 # 842150400 is from original fuzzed ext4 image in bug report
27 $DEBUGFS_PROG -w -R "ssv first_meta_bg 842150400" $SCRATCH_DEV >> $seqres.full 2>&1
28
29 echo "Try to mount a modified ext4 fs"
30 _try_scratch_mount >> $seqres.full 2>&1 || echo "Fail to mount ext4 fs expectedly"
31
32 # success, all done
33 status=0
34 exit