On Wed, Jan 08, 2020 at 05:27:58PM +0800, yu kuai wrote: > The cmd used in xfs_db to corrupt xattr is "blocktrash -x 32 > -y $((blksz * 8)) -n8 -3", which means select random 8 bit from 32 to > end of the block, and the changed bits are randomized. However, > there is a small chance that corrupting xattr failed because irrelevant > bits are chossen or the chooosen bits are not changed, which lead to > output missmatch: > QA output created by 126 QA output created by 126 > + create scratch fs + create scratch fs > + mount fs image + mount fs image > + make some files + make some files > + check fs + check fs > + check xattr + check xattr > + corrupt xattr + corrupt xattr > + mount image && modify xattr + mount image && modify xattr > + repair fs + repair fs > + mount image (2) + mount image (2) > + chattr -R -i + chattr -R -i > + modify xattr (2) + modify xattr (2) > > # file: tmp/scratch/attrfile > > user.x00000000="0000000000000000" > > > + check fs (2) + check fs (2) > > Fix the problem by adding a seed for random processing to select same > bits each time, and inverting the selected bits. > > Signed-off-by: yu kuai <yukuai3@xxxxxxxxxx> > --- > tests/xfs/126 | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tests/xfs/126 b/tests/xfs/126 > index 4f9f8cf9..9b57e58b 100755 > --- a/tests/xfs/126 > +++ b/tests/xfs/126 > @@ -37,7 +37,7 @@ test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc > _require_attrs > _require_populate_commands > _require_xfs_db_blocktrash_z_command > -test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3" > +test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -2" TBH I've wondered if blocktrash -3 and fuzz-random should snapshot the buffer before randomizing it and try again if the contents don't change? I suspect most of our fuzz tests expect "randomize the ____" to return with ____ full of random junk, not the exact same contents as before. --D > rm -f $seqres.full > > @@ -72,7 +72,7 @@ echo "+ corrupt xattr" > loff=1 > while true; do > _scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" | grep -q 'file attr block is unmapped' && break > - _scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full > + _scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -s 1024 -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full > loff="$((loff + 1))" > done > > -- > 2.17.2 >