mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
ext4: check mount's handling for very large s_first_meta_bg
On ext4 filesystem, the kernel carshes at mount time when s_first_meta_bg's value exceeds the largest possible meta_bg number. This kernel bug has been fixed in: 3a4b77c ext4: validate s_first_meta_bg at mount time [eguan: add comments on the first_meta_bg value] Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test ext4/025
|
||||
#
|
||||
# Regression test for commit:
|
||||
# 3a4b77c ("ext4: validate s_first_meta_bg at mount time").
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2017 Fujitsu. All Rights Reserved.
|
||||
# Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
|
||||
seq=`basename $0`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
tmp=/tmp/$$
|
||||
status=1 # failure is the default!
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
rm -f $tmp.*
|
||||
}
|
||||
|
||||
# get standard environment and checks
|
||||
. ./common/rc
|
||||
. ./common/filter
|
||||
|
||||
# remove previous $seqres.full before test
|
||||
rm -f $seqres.full
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs ext4
|
||||
_supported_os Linux
|
||||
_require_scratch_nocheck
|
||||
_require_command "$DEBUGFS_PROG" debugfs
|
||||
_require_ext4_mkfs_feature "bigalloc,meta_bg,^resize_inode"
|
||||
|
||||
echo "Create ext4 fs and modify first_meta_bg's value"
|
||||
_scratch_mkfs "-O bigalloc,meta_bg,^resize_inode" >> $seqres.full 2>&1
|
||||
|
||||
# set a big enough first_meta_bg to trigger buffer overrun
|
||||
# 842150400 is from original fuzzed ext4 image in bug report
|
||||
$DEBUGFS_PROG -w -R "ssv first_meta_bg 842150400" $SCRATCH_DEV >> $seqres.full 2>&1
|
||||
|
||||
echo "Try to mount a modified ext4 fs"
|
||||
_scratch_mount >> $seqres.full 2>&1 || echo "Fail to mount ext4 fs expectedly"
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
exit
|
||||
@@ -0,0 +1,4 @@
|
||||
QA output created by 025
|
||||
Create ext4 fs and modify first_meta_bg's value
|
||||
Try to mount a modified ext4 fs
|
||||
Fail to mount ext4 fs expectedly
|
||||
@@ -27,6 +27,7 @@
|
||||
022 auto quick attr dangerous
|
||||
023 auto quick scrub
|
||||
024 auto quick encrypt dangerous
|
||||
025 auto quick fuzzers dangerous
|
||||
271 auto rw quick
|
||||
301 aio auto ioctl rw stress defrag
|
||||
302 aio auto ioctl rw stress defrag
|
||||
|
||||
Reference in New Issue
Block a user