Skip to contentSkip to conversation

xfs_repair: test for false positive reserved attr name use

PATCH In review Eric Sandeen 3 participants 8 messages May 14, 2015 – May 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_repair: test for false positive reserved attr name use

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.

---

patch for xfs_repair will be sent shortly

tests/xfs/053 new file +76 -0
new file mode 100755
index 0000000..284c014
@@ -0,0 +1,76 @@
+#! /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
+
+# real QA test starts here
+
+_supported_fs xfs
+_supported_os IRIX Linux
+_require_scratch
+
+rm -f $seqres.full
+
+_scratch_mount
+
+# Create root namespace 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 -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
tests/xfs/053.out new file +11 -0
new file mode 100644
index 0000000..d876555
@@ -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
tests/xfs/group +1 -0
index 58144d2..26dd881 100644
@@ -50,6 +50,7 @@
 050 quota auto quick
 051 auto log metadata
 052 quota db auto quick
+053 acl auto
 054 quota auto quick
 055 dump ioctl remote tape
 056 dump ioctl auto quick
#1 lore raw
Quoted 47 lines · Eric Sandeen

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.

---

patch for xfs_repair will be sent shortly

tests/xfs/053 new file +24 -0
new file mode 100755
index 0000000..284c014
@@ -0,0 +1,76 @@
+#! /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

tests/xfs/053 line 34

Quoted 10 lines
tests/xfs/053 new file +10 -0
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!

I haven't run the test yet, but I don't see the trap and cleanup function, is that on purpose?

tests/xfs/053 line 38

Quoted 4 lines
tests/xfs/053 new file +4 -0
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter

. ./common/attr and _require_attrs ?

tests/xfs/053 line 46

Quoted 8 lines
tests/xfs/053 new file +8 -0
+
+# real QA test starts here
+
+_supported_fs xfs
+_supported_os IRIX Linux
+_require_scratch
+
+rm -f $seqres.full

Seems this file is not used and the rm can be omitted.

tests/xfs/053 line 48

Quoted 2 lines
tests/xfs/053 new file +2 -0
+
+_scratch_mount

Should _scratch_mkfs first

tests/xfs/053 line 57

Quoted 9 lines
tests/xfs/053 new file +9 -0
+
+# Create root namespace 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.*

If it's fresh fs, this seems unnecessary.

tests/xfs/053 line 66

Quoted 9 lines
tests/xfs/053 new file +9 -0
+
+# 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 -R -s $NAME -V "Wow, such $NAME" $SCRATCH_MNT/${seq}.${NAME} \
+		| _filter_scratch

$ATTR_PROG

Thanks,
Eryu

Quoted 44 lines
tests/xfs/053 new file +10 -0
+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
tests/xfs/053.out new file +11 -0
new file mode 100644
index 0000000..d876555
@@ -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
tests/xfs/group +1 -1
index 58144d2..26dd881 100644
@@ -50,6 +50,7 @@
 050 quota auto quick
 051 auto log metadata
 052 quota db auto quick
+053 acl auto
 054 quota auto quick
 055 dump ioctl remote tape
 056 dump ioctl auto quick
 
--

To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

All good advice; sigh, I am rusty! Thanks, will resend with fixes.

(Started as using test dev so left some things out; not sure I need a trap if there is nothing to clean up? Also do we need to require attr on xfs? Can't remember if we can compile that out, but I guess it's harmless to include it)

Thanks,
-Eric

Quoted 163 lines · Eryu Guan
Quoted 49 lines · Eric Sandeen

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.

---

patch for xfs_repair will be sent shortly

tests/xfs/053 new file +24 -0
new file mode 100755
index 0000000..284c014
@@ -0,0 +1,76 @@
+#! /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

tests/xfs/053 line 34

Quoted 10 lines
tests/xfs/053 new file +10 -0
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!

I haven't run the test yet, but I don't see the trap and cleanup function, is that on purpose?

tests/xfs/053 line 38

Quoted 4 lines
tests/xfs/053 new file +4 -0
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter

. ./common/attr and _require_attrs ?

tests/xfs/053 line 46

Quoted 8 lines
tests/xfs/053 new file +8 -0
+
+# real QA test starts here
+
+_supported_fs xfs
+_supported_os IRIX Linux
+_require_scratch
+
+rm -f $seqres.full

Seems this file is not used and the rm can be omitted.

tests/xfs/053 line 48

Quoted 2 lines
tests/xfs/053 new file +2 -0
+
+_scratch_mount

Should _scratch_mkfs first

tests/xfs/053 line 57

Quoted 9 lines
tests/xfs/053 new file +9 -0
+
+# Create root namespace 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.*

If it's fresh fs, this seems unnecessary.

tests/xfs/053 line 66

Quoted 9 lines
tests/xfs/053 new file +9 -0
+
+# 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 -R -s $NAME -V "Wow, such $NAME" $SCRATCH_MNT/${seq}.${NAME} \
+        | _filter_scratch

$ATTR_PROG

Thanks,
Eryu

Quoted 40 lines
tests/xfs/053 new file +10 -0
+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
tests/xfs/053.out new file +11 -0
new file mode 100644
index 0000000..d876555
@@ -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
tests/xfs/group +0 -0
index 58144d2..26dd881 100644
@@ -50,6 +50,7 @@

050 quota auto quick
051 auto log metadata
052 quota db auto quick
+053 acl auto
054 quota auto quick
055 dump ioctl remote tape
056 dump ioctl auto quick

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 3 lines · Eric Sandeen

All good advice; sigh, I am rusty! Thanks, will resend with fixes.

(Started as using test dev so left some things out; not sure I need a trap if there is nothing to clean up? Also do we need to require attr on xfs? Can't remember if we can compile that out, but I guess it's harmless to include it)

I did a "grep _require_attrs tests/xfs/*" and result showed several tests in xfs require attrs. At least it checks if ATTR_PROG exists :)

And I think we need a trap and cleanup even if there's no obvious things to clean, some functions use $tmp.xxx internally, a cleanup could remove all these tmp files too, and trap plays with exit status, so it's still needed.

Thanks,
Eryu

Quoted 171 lines

Thanks,
-Eric

Quoted 154 lines · Eryu Guan
Quoted 49 lines · Eric Sandeen

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.

---

patch for xfs_repair will be sent shortly

tests/xfs/053 new file +24 -0
new file mode 100755
index 0000000..284c014
@@ -0,0 +1,76 @@
+#! /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

tests/xfs/053 line 34

Quoted 10 lines
tests/xfs/053 new file +10 -0
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!

I haven't run the test yet, but I don't see the trap and cleanup function, is that on purpose?

tests/xfs/053 line 38

Quoted 4 lines
tests/xfs/053 new file +4 -0
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter

. ./common/attr and _require_attrs ?

tests/xfs/053 line 46

Quoted 8 lines
tests/xfs/053 new file +8 -0
+
+# real QA test starts here
+
+_supported_fs xfs
+_supported_os IRIX Linux
+_require_scratch
+
+rm -f $seqres.full

Seems this file is not used and the rm can be omitted.

tests/xfs/053 line 48

Quoted 2 lines
tests/xfs/053 new file +2 -0
+
+_scratch_mount

Should _scratch_mkfs first

tests/xfs/053 line 57

Quoted 9 lines
tests/xfs/053 new file +9 -0
+
+# Create root namespace 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.*

If it's fresh fs, this seems unnecessary.

tests/xfs/053 line 66

Quoted 9 lines
tests/xfs/053 new file +9 -0
+
+# 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 -R -s $NAME -V "Wow, such $NAME" $SCRATCH_MNT/${seq}.${NAME} \
+        | _filter_scratch

$ATTR_PROG

Thanks,
Eryu

Quoted 40 lines
tests/xfs/053 new file +10 -0
+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
tests/xfs/053.out new file +11 -0
new file mode 100644
index 0000000..d876555
@@ -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
tests/xfs/group +0 -0
index 58144d2..26dd881 100644
@@ -50,6 +50,7 @@

050 quota auto quick
051 auto log metadata
052 quota db auto quick
+053 acl auto
054 quota auto quick
055 dump ioctl remote tape
056 dump ioctl auto quick

Quoted 9 lines
Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 7 lines · Eryu Guan
Quoted 3 lines · Eric Sandeen

All good advice; sigh, I am rusty! Thanks, will resend with fixes.

(Started as using test dev so left some things out; not sure I need a trap if there is nothing to clean up? Also do we need to require attr on xfs? Can't remember if we can compile that out, but I guess it's harmless to include it)

I did a "grep _require_attrs tests/xfs/*" and result showed several tests in xfs require attrs. At least it checks if ATTR_PROG exists :)

Yes, I forgot about that ;(

Quoted 4 lines

And I think we need a trap and cleanup even if there's no obvious things to clean, some functions use $tmp.xxx internally, a cleanup could remove all these tmp files too, and trap plays with exit status, so it's still needed.

Fair enough, thanks for the review.

-Eric

#5 lore raw

PATCH v2 1/1 xfs_repair: test for false positive reserved attr name use

In reply to Eric Sandeen

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.

---

V2: Fix all the dumb, thanks to Eryu :)
Add it to more groups, too.

tests/xfs/053 new file +84 -0
new file mode 100755
index 0000000..f1d62f6
@@ -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 s >/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
tests/xfs/053.out new file +11 -0
new file mode 100644
index 0000000..d876555
@@ -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
tests/xfs/group +1 -0
index 58144d2..26dd881 100644
@@ -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
Reviewed-by on v2 1/1
#6 lore raw
Quoted 5 lines · Eric Sandeen

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.

Quoted 8 lines

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.

Looks good to me, I saw test failed as

xfs/053 1s ... 1s
_check_xfs_filesystem: filesystem on /dev/sda6 is inconsistent (r) (see /root/xfstests/results//xfs/053.full)

and 053.full showed

Too many ACL entries, count 1466922796
entry contains illegal value in attribute named SGI_ACL_FILE or SGI_ACL_DEFAULT would remove attribute entry 0 for inode 102
Too many ACL entries, count 1466922796
entry contains illegal value in attribute named SGI_ACL_FILE or SGI_ACL_DEFAULT would remove attribute entry 0 for inode 103

(with one minor issue inline)

Quoted 56 lines

---

V2: Fix all the dumb, thanks to Eryu :)
Add it to more groups, too.

tests/xfs/053 new file +45 -0
new file mode 100755
index 0000000..f1d62f6
@@ -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.*
+}

tests/xfs/053 line 55

Quoted 10 lines
tests/xfs/053 new file +10 -0
+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 s >/dev/null 2>&1

^^^ extra s here

Thanks,
Eryu

Quoted 64 lines
tests/xfs/053 new file +29 -0
+_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
tests/xfs/053.out new file +11 -0
new file mode 100644
index 0000000..d876555
@@ -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
tests/xfs/group +1 -1
index 58144d2..26dd881 100644
@@ -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
 
 
--

To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

PATCH v3 1/1 xfs_repair: test for false positive reserved attr name use

In reply to Eric Sandeen

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.

---

V2: Fix all the dumb, thanks to Eryu
Add it to more groups, too.
V3: fix stray 's' after scratch_mkfs

tests/xfs/053 new file +84 -0
new file mode 100755
index 0000000..f1d62f6
@@ -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
tests/xfs/053.out new file +11 -0
new file mode 100644
index 0000000..d876555
@@ -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
tests/xfs/group +1 -0
index 58144d2..26dd881 100644
@@ -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