From patchwork Fri May 15 14:23:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 6414441 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4F9F69F1C1 for ; Fri, 15 May 2015 14:24:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4DA1A204EB for ; Fri, 15 May 2015 14:24:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E4E520451 for ; Fri, 15 May 2015 14:24:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754051AbbEOOYF (ORCPT ); Fri, 15 May 2015 10:24:05 -0400 Received: from sandeen.net ([63.231.237.45]:45506 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753859AbbEOOXv (ORCPT ); Fri, 15 May 2015 10:23:51 -0400 Received: from liberator.sandeen.net (liberator.sandeen.net [10.0.0.4]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by sandeen.net (Postfix) with ESMTPSA id 481876573841; Fri, 15 May 2015 09:23:50 -0500 (CDT) Message-ID: <55560175.60108@sandeen.net> Date: Fri, 15 May 2015 09:23:49 -0500 From: Eric Sandeen MIME-Version: 1.0 To: Eric Sandeen , fstests@vger.kernel.org Subject: [PATCH V3] xfs_repair: test for false positive reserved attr name use References: <555414EA.80301@redhat.com> <5554B18D.1060006@sandeen.net> In-Reply-To: <5554B18D.1060006@sandeen.net> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP xfs_repair compares attr names in the root namespace to two special/reserved names, "SGI_ACL_FILE" and "SGI_ACL_DEFAULT" and if the value in them aren't valid acls, flags this as an inconsistency. However, due to various bugs, xfs_repair may only compare a smaller portion of the on-disk value; hence either substrings or superstrings may match, and false-positive corruption will be detected. This test checks for those false positives; i.e. the ACL names created in this test may cause xfs_repair to "fix" them, but it should not. Signed-off-by: Eric Sandeen Reviewed-by: Eryu Guan --- V2: Fix all the dumb, thanks to Eryu Add it to more groups, too. V3: fix stray 's' after scratch_mkfs -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tests/xfs/053 b/tests/xfs/053 new file mode 100755 index 0000000..f1d62f6 --- /dev/null +++ b/tests/xfs/053 @@ -0,0 +1,84 @@ +#! /bin/bash +# FS QA Test 053 +# +# Ensure that xfs_repair can properly spot SGI_ACL_FILE +# and SGI_ACL_DEFAULT in the root attr namespace. +# +# Due to bugs here and there, we sometimes matched on partial +# strings with those names, and threw off xfs_repair. +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 Red Hat, 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! + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +_cleanup() +{ + cd / + rm -f $tmp.* +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# real QA test starts here + +_supported_fs xfs +_supported_os IRIX Linux +_require_scratch +_require_attrs + +_scratch_mkfs >/dev/null 2>&1 +_scratch_mount + +# Create root attr names which are substrings or superstrings +# of the reserved ACL names, and make sure xfs_repair copes. + +# Due to various bugs, either the compared length was shorter +# than the reserved name (7 chars), so substrings matched, and/or only +# the reserved name length was compared, so superstrings matched. + +rm -f $SCRATCH_MNT/$seq.* + +# actual reserved names: +# SGI_ACL_FILE SGI_ACL_DEFAULT +for NAME in SGI_ACL \ + SGI_ACL_F SGI_ACL_D \ + SGI_ACL_FILE_FOO SGI_ACL_DEFAULT_FOO; do + touch $SCRATCH_MNT/${seq}.${NAME} + $ATTR_PROG -R -s $NAME -V "Wow, such $NAME" $SCRATCH_MNT/$seq.$NAME \ + | _filter_scratch +done + +# Older repair failed because it sees the above names as matching +# SGI_ACL_FILE / SGI_ACL_DEFAULT but w/o valid acls on them + +# The test harness will catch this (false positive) corruption + +# success, all done +status=0 +exit diff --git a/tests/xfs/053.out b/tests/xfs/053.out new file mode 100644 index 0000000..d876555 --- /dev/null +++ b/tests/xfs/053.out @@ -0,0 +1,11 @@ +QA output created by 053 +Attribute "SGI_ACL" set to a 17 byte value for SCRATCH_MNT/053.SGI_ACL: +Wow, such SGI_ACL +Attribute "SGI_ACL_F" set to a 19 byte value for SCRATCH_MNT/053.SGI_ACL_F: +Wow, such SGI_ACL_F +Attribute "SGI_ACL_D" set to a 19 byte value for SCRATCH_MNT/053.SGI_ACL_D: +Wow, such SGI_ACL_D +Attribute "SGI_ACL_FILE_FOO" set to a 26 byte value for SCRATCH_MNT/053.SGI_ACL_FILE_FOO: +Wow, such SGI_ACL_FILE_FOO +Attribute "SGI_ACL_DEFAULT_FOO" set to a 29 byte value for SCRATCH_MNT/053.SGI_ACL_DEFAULT_FOO: +Wow, such SGI_ACL_DEFAULT_FOO diff --git a/tests/xfs/group b/tests/xfs/group index 58144d2..26dd881 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -50,6 +50,7 @@ 050 quota auto quick 051 auto log metadata 052 quota db auto quick +053 attr acl repair quick auto 054 quota auto quick 055 dump ioctl remote tape 056 dump ioctl auto quick