From patchwork Wed Jun 27 16:59:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 10492221 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B198860325 for ; Wed, 27 Jun 2018 17:00:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D508A29812 for ; Wed, 27 Jun 2018 17:00:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B85312987F; Wed, 27 Jun 2018 17:00:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 781192986E for ; Wed, 27 Jun 2018 17:00:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965390AbeF0RAJ (ORCPT ); Wed, 27 Jun 2018 13:00:09 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37700 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965299AbeF0RAH (ORCPT ); Wed, 27 Jun 2018 13:00:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9328401B3A4; Wed, 27 Jun 2018 17:00:06 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-56.pek2.redhat.com [10.72.12.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 085142314F; Wed, 27 Jun 2018 17:00:04 +0000 (UTC) From: Zorro Lang To: fstests@vger.kernel.org Cc: linux-xfs@vger.kernel.org Subject: [PATCH] xfs: test bad character in xfs_db field list selector string Date: Thu, 28 Jun 2018 00:59:57 +0800 Message-Id: <20180627165957.12892-1-zlang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 27 Jun 2018 17:00:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 27 Jun 2018 17:00:06 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'zlang@redhat.com' RCPT:'' Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 "945e47e2 xfs_db: fix crash when field list selector string has trailing slash". Signed-off-by: Zorro Lang Reviewed-by: Darrick J. Wong --- tests/xfs/450 | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/450.out | 7 +++++++ tests/xfs/group | 1 + 3 files changed, 57 insertions(+) create mode 100755 tests/xfs/450 create mode 100644 tests/xfs/450.out diff --git a/tests/xfs/450 b/tests/xfs/450 new file mode 100755 index 00000000..73b0cad8 --- /dev/null +++ b/tests/xfs/450 @@ -0,0 +1,49 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Red Hat Inc. All Rights Reserved. +# +# FS QA Test 450 +# +# 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/450.out b/tests/xfs/450.out new file mode 100644 index 00000000..dab51786 --- /dev/null +++ b/tests/xfs/450.out @@ -0,0 +1,7 @@ +QA output created by 450 += check bad character * = +bad character in field * += check bad character trailing slash = +bad character in field \ += check missing closing quote = +missing closing quote diff --git a/tests/xfs/group b/tests/xfs/group index 932ab909..4d8e0b30 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -447,3 +447,4 @@ 447 auto mount 448 auto quick fuzzers 449 auto quick +450 auto db