xfs: fuzz every field of every structure

Previously, our XFS fuzzing efforts were limited to using the xfs_db
blocktrash command to scribble garbage all over a block.  This is
pretty easy to discover; it would be far more interesting if we could
fuzz individual fields looking for unhandled corner cases.  Since we
now have an online scrub tool, use it to check for our targeted
corruptions prior to the usual steps of writing to the FS, taking it
offline, repairing, and re-checking.

These tests use the new xfs_db 'fuzz' command to test corner case
handling of every field.  The 'print' command tells us which fields
are available, and the fuzz command can write zeroes or ones to the
field; set the high, middle, or low bit; add or subtract numbers; or
randomize the field.  We loop through all fields and all fuzz verbs to
see if we can trip up the kernel.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Darrick J. Wong
2017-01-21 00:11:21 -08:00
committed by Eryu Guan
parent 898e0cf2a4
commit f5f0c11a67
144 changed files with 4908 additions and 0 deletions
Executable
+60
View File
@@ -0,0 +1,60 @@
#! /bin/bash
# FS QA Test No. 023
#
# Populate a ext4 filesystem and ensure that scrub and repair are happy.
#
#-----------------------------------------------------------------------
# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
#
# 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"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup()
{
cd /
rm -rf $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/populate
. ./common/fuzzy
# real QA test starts here
_supported_os Linux
_supported_fs ext4
_require_scratch
_require_scrub
echo "Format and populate"
_scratch_populate_cached > $seqres.full 2>&1
echo "Scrub"
_scratch_mount >> $seqres.full 2>&1
_scratch_scrub >> $seqres.full
# success, all done
status=0
exit
+3
View File
@@ -0,0 +1,3 @@
QA output created by 023
Format and populate
Scrub
+1
View File
@@ -25,6 +25,7 @@
020 auto quick ioctl rw
021 auto quick
022 auto quick attr dangerous
023 auto quick scrub
271 auto rw quick
301 aio auto ioctl rw stress
302 aio auto ioctl rw stress
Executable
+63
View File
@@ -0,0 +1,63 @@
#! /bin/bash
# FS QA Test No. 349
#
# Populate a XFS filesystem and ensure that scrub and repair are happy.
# Use xfs_repair to fix the corruption.
#
#-----------------------------------------------------------------------
# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
#
# 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"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup()
{
cd /
rm -rf $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/populate
. ./common/fuzzy
# real QA test starts here
_supported_os Linux
_supported_fs xfs
_require_scratch
_require_scrub
_require_populate_commands
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "Scrub"
_scratch_mount >> $seqres.full 2>&1
_scratch_scrub >> $seqres.full
# success, all done
status=0
exit
+3
View File
@@ -0,0 +1,3 @@
QA output created by 349
Format and populate
Scrub
Executable
+60
View File
@@ -0,0 +1,60 @@
#! /bin/bash
# FS QA Test No. 350
#
# Populate a XFS filesystem and fuzz every superblock field.
# Use xfs_repair to fix the corruption.
#
#-----------------------------------------------------------------------
# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
#
# 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"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup()
{
cd /
rm -rf $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/populate
. ./common/fuzzy
# real QA test starts here
_supported_os Linux
_supported_fs xfs
_require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "Fuzz superblock"
_scratch_xfs_fuzz_metadata '' 'offline' 'sb 0' >> $seqres.full
echo "Done fuzzing superblock"
# success, all done
status=0
exit
+4
View File
@@ -0,0 +1,4 @@
QA output created by 350
Format and populate
Fuzz superblock
Done fuzzing superblock
Executable
+60
View File
@@ -0,0 +1,60 @@
#! /bin/bash
# FS QA Test No. 351
#
# Populate a XFS filesystem and fuzz every superblock field.
# Use xfs_scrub to fix the corruption.
#
#-----------------------------------------------------------------------
# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
#
# 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"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup()
{
cd /
rm -rf $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/populate
. ./common/fuzzy
# real QA test starts here
_supported_os Linux
_supported_fs xfs
_require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "Fuzz superblock"
_scratch_xfs_fuzz_metadata '' 'online' 'sb 1' >> $seqres.full
echo "Done fuzzing superblock"
# success, all done
status=0
exit
+4
View File
@@ -0,0 +1,4 @@
QA output created by 351
Format and populate
Fuzz superblock
Done fuzzing superblock
Executable
+60
View File
@@ -0,0 +1,60 @@
#! /bin/bash
# FS QA Test No. 352
#
# Populate a XFS filesystem and fuzz every AGF field.
# Use xfs_repair to fix the corruption.
#
#-----------------------------------------------------------------------
# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
#
# 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-1302 USA
#-----------------------------------------------------------------------
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup()
{
cd /
rm -rf $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/populate
. ./common/fuzzy
# real QA test starts here
_supported_os Linux
_supported_fs xfs
_require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "Fuzz AGF"
_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' >> $seqres.full
echo "Done fuzzing AGF"
# success, all done
status=0
exit
+4
View File
@@ -0,0 +1,4 @@
QA output created by 352
Format and populate
Fuzz AGF
Done fuzzing AGF
Executable
+60
View File
@@ -0,0 +1,60 @@
#! /bin/bash
# FS QA Test No. 353
#
# Populate a XFS filesystem and fuzz every AGF field.
# Use xfs_scrub to fix the corruption.
#
#-----------------------------------------------------------------------
# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
#
# 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-1302 USA
#-----------------------------------------------------------------------
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup()
{
cd /
rm -rf $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/populate
. ./common/fuzzy
# real QA test starts here
_supported_os Linux
_supported_fs xfs
_require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "Fuzz AGF"
_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' >> $seqres.full
echo "Done fuzzing AGF"
# success, all done
status=0
exit
+4
View File
@@ -0,0 +1,4 @@
QA output created by 353
Format and populate
Fuzz AGF
Done fuzzing AGF
Executable
+65
View File
@@ -0,0 +1,65 @@
#! /bin/bash
# FS QA Test No. 354
#
# Populate a XFS filesystem and fuzz every AGFL field.
# Use xfs_repair to fix the corruption.
#
#-----------------------------------------------------------------------
# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
#
# 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-1303 USA
#-----------------------------------------------------------------------
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup()
{
cd /
rm -rf $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/populate
. ./common/fuzzy
# real QA test starts here
_supported_os Linux
_supported_fs xfs
_require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "Fuzz AGFL"
_scratch_xfs_fuzz_metadata '' 'offline' 'agfl 0' >> $seqres.full
echo "Done fuzzing AGFL"
echo "Fuzz AGFL flfirst"
flfirst=$(_scratch_xfs_db -c 'agf 0' -c 'p flfirst' | sed -e 's/flfirst = //g')
SCRATCH_XFS_LIST_METADATA_FIELDS="bno[${flfirst}]" _scratch_xfs_fuzz_metadata '' 'offline' 'agfl 0' >> $seqres.full
echo "Done fuzzing AGFL flfirst"
# success, all done
status=0
exit
+6
View File
@@ -0,0 +1,6 @@
QA output created by 354
Format and populate
Fuzz AGFL
Done fuzzing AGFL
Fuzz AGFL flfirst
Done fuzzing AGFL flfirst
Executable
+65
View File
@@ -0,0 +1,65 @@
#! /bin/bash
# FS QA Test No. 355
#
# Populate a XFS filesystem and fuzz every AGFL field.
# Use xfs_scrub to fix the corruption.
#
#-----------------------------------------------------------------------
# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
#
# 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-1303 USA
#-----------------------------------------------------------------------
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup()
{
cd /
rm -rf $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/populate
. ./common/fuzzy
# real QA test starts here
_supported_os Linux
_supported_fs xfs
_require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "Fuzz AGFL"
_scratch_xfs_fuzz_metadata '' 'online' 'agfl 0' >> $seqres.full
echo "Done fuzzing AGFL"
echo "Fuzz AGFL flfirst"
flfirst=$(_scratch_xfs_db -c 'agf 0' -c 'p flfirst' | sed -e 's/flfirst = //g')
SCRATCH_XFS_LIST_METADATA_FIELDS="bno[${flfirst}]" _scratch_xfs_fuzz_metadata '' 'online' 'agfl 0' >> $seqres.full
echo "Done fuzzing AGFL flfirst"
# success, all done
status=0
exit
+6
View File
@@ -0,0 +1,6 @@
QA output created by 355
Format and populate
Fuzz AGFL
Done fuzzing AGFL
Fuzz AGFL flfirst
Done fuzzing AGFL flfirst
Executable
+60
View File
@@ -0,0 +1,60 @@
#! /bin/bash
# FS QA Test No. 356
#
# Populate a XFS filesystem and fuzz every AGI field.
# Use xfs_repair to fix the corruption.
#
#-----------------------------------------------------------------------
# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
#
# 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-1303 USA
#-----------------------------------------------------------------------
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup()
{
cd /
rm -rf $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/populate
. ./common/fuzzy
# real QA test starts here
_supported_os Linux
_supported_fs xfs
_require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "Fuzz AGI"
_scratch_xfs_fuzz_metadata '' 'offline' 'agi 0' >> $seqres.full
echo "Done fuzzing AGI"
# success, all done
status=0
exit
+4
View File
@@ -0,0 +1,4 @@
QA output created by 356
Format and populate
Fuzz AGI
Done fuzzing AGI
Executable
+60
View File
@@ -0,0 +1,60 @@
#! /bin/bash
# FS QA Test No. 357
#
# Populate a XFS filesystem and fuzz every AGI field.
# Use xfs_scrub to fix the corruption.
#
#-----------------------------------------------------------------------
# Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
#
# 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-1303 USA
#-----------------------------------------------------------------------
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup()
{
cd /
rm -rf $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/populate
. ./common/fuzzy
# real QA test starts here
_supported_os Linux
_supported_fs xfs
_require_scratch_xfs_fuzz_fields
echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "Fuzz AGI"
_scratch_xfs_fuzz_metadata '' 'online' 'agi 0' >> $seqres.full
echo "Done fuzzing AGI"
# success, all done
status=0
exit

Some files were not shown because too many files have changed in this diff Show More