xfs: test bad character in xfs_db field list selector string
authorZorro Lang <zlang@redhat.com>
Wed, 27 Jun 2018 16:59:57 +0000 (00:59 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 1 Jul 2018 12:35:27 +0000 (20:35 +0800)
Bad characters likes tailing asterisk, slash or quote in xfs_db
field string can trigger a xfs_db crash. This bug has been fixed by
xfsprogs commit 945e47e2fcc5 ("xfs_db: fix crash when field list
selector string has trailing slash").

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

diff --git a/tests/xfs/452 b/tests/xfs/452
new file mode 100755 (executable)
index 0000000..0a23636
--- /dev/null
@@ -0,0 +1,49 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2018 Red Hat Inc.  All Rights Reserved.
+#
+# FS QA Test 452
+#
+# Test xfs_db by bad character in field list selector string. The issue
+# has been fixed by xfsprogs 945e47e2.
+#
+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 15
+
+_cleanup()
+{
+       cd /
+       rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# Modify as appropriate.
+_supported_fs xfs
+_supported_os Linux
+_require_scratch
+
+_scratch_mkfs_xfs >> $seqres.full 2>&1
+inum=`_scratch_xfs_get_metadata_field rootino "sb 0"`
+
+echo "= check bad character * ="
+_scratch_xfs_db -c "inode $inum" -c "print core.*"
+echo "= check bad character trailing slash ="
+_scratch_xfs_db -c "inode $inum" -c "print core.\\"
+echo "= check missing closing quote ="
+_scratch_xfs_db -c "inode $inum" -c "print core.\""
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/452.out b/tests/xfs/452.out
new file mode 100644 (file)
index 0000000..4917ded
--- /dev/null
@@ -0,0 +1,7 @@
+QA output created by 452
+= check bad character * =
+bad character in field *
+= check bad character trailing slash =
+bad character in field \
+= check missing closing quote =
+missing closing quote 
index db2b2e290379827654dd14731a444ffa4424aa38..39b0e842ba1f94c6e73402979339dbff09b5020b 100644 (file)
 449 auto quick
 450 auto quick rmap
 451 auto quick metadata repair
+452 auto db