generic: another mread-after-eof test
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 5 Oct 2018 00:19:14 +0000 (17:19 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 14 Oct 2018 15:05:26 +0000 (23:05 +0800)
Add Brian Foster's alternate reproducer code for the mread-after-eof
problem so that we increase the chances that either this or generic/499
will catch the problem.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/511 [new file with mode: 0755]
tests/generic/511.out [new file with mode: 0644]
tests/generic/group

diff --git a/tests/generic/511 b/tests/generic/511
new file mode 100755 (executable)
index 0000000..4d133f4
--- /dev/null
@@ -0,0 +1,54 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2018 Oracle, Inc.  All Rights Reserved.
+#
+# FS QA Test No. 511
+#
+# Test a specific sequence of fsx operations that causes an mmap read past
+# eof to return nonzero contents.
+#
+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()
+{
+       cd /
+       rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/punch
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_xfs_io_command "fzero"
+
+rm -f $seqres.full
+
+_scratch_mkfs_sized $((1024 * 1024 * 256)) >>$seqres.full 2>&1
+_scratch_mount
+
+$XFS_IO_PROG -fc "pwrite 0 256m" -c fsync $SCRATCH_MNT/file >>$seqres.full 2>&1
+rm -f $SCRATCH_MNT/file
+
+cat >> $tmp.fsxops << ENDL
+truncate 0x0 0x1f0d6 0x380e1
+write 0x1ad87 0x6c99 0x180d6
+zero_range 0x14426 0xd3aa 0x21a20 keep_size
+mapread 0x1f69a 0x2386 0x21a20
+ENDL
+
+victim=$SCRATCH_MNT/a
+touch $victim
+$here/ltp/fsx --replay-ops $tmp.fsxops $victim > $tmp.output 2>&1 || cat $tmp.output
+
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/generic/511.out b/tests/generic/511.out
new file mode 100644 (file)
index 0000000..cb0ea9e
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 511
+Silence is golden
index 635503d32a0b14137dff41a1940124c75d2d1d0b..348214acde5d691bb8b76216f469f15e6d40ddec 100644 (file)
 508 shutdown auto quick metadata
 509 auto quick log
 510 auto quick log
+511 auto quick rw zero