Skip to contentSkip to conversation

xfs/083: redirect populate stderr to avoid spurious attr restore warnings

PATCH In review Avinesh Kumar 3 participants 13 messages Jul 10 – Sep 18

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs/083: redirect populate stderr to avoid spurious attr restore warnings

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 fix)[0] makes "setfattr --restore" print warnings on stderr. _scratch_populate uses it, and xfs/083 only redirects stdout, so the warnings leak into the test output and fail it.
Redirect stderr to $seqres.full too.

+Warning: option --restore=file is unsafe without option -P (--physical) as it traverses symbolic links in pathnames +Warning: option --restore=file is unsafe without option -h (--no-dereference) as it dereferences symbolic link pathnames

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---
 tests/xfs/083 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/083 +1 -1
index 9291c8c0..48deaafa 100755
@@ -91,7 +91,7 @@ echo "+ create scratch fs" >> $seqres.full
 _scratch_mkfs_xfs >> $seqres.full 2>&1
 
 echo "+ populate fs image" >> $seqres.full
-_scratch_populate >> $seqres.full
+_scratch_populate >> $seqres.full 2>&1
 
 echo "+ check fs" >> $seqres.full
 _repair_scratch_fs >> $seqres.full 2>&1 || _fail "should pass initial fsck"
Signature · 1 line
2.54.0
#1 lore raw
Quoted 22 lines · Avinesh Kumar

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 fix)[0] makes "setfattr --restore" print warnings on stderr. _scratch_populate uses it, and xfs/083 only redirects stdout, so the warnings leak into the test output and fail it.
Redirect stderr to $seqres.full too.

(quoted diff) +2 -0
+Warning: option --restore=file is unsafe without option -P (--physical) as it traverses symbolic links in pathnames
+Warning: option --restore=file is unsafe without option -h (--no-dereference) as it dereferences symbolic link pathnames

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---
 tests/xfs/083 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/xfs/083 +0 -0
index 9291c8c0..48deaafa 100755

tests/xfs/083 echo "+ create scratch fs" >> $seqres.full · line 94

Quoted 5 lines
tests/xfs/083 +1 -1
@@ -91,7 +91,7 @@ echo "+ create scratch fs" >> $seqres.full
 _scratch_mkfs_xfs >> $seqres.full 2>&1
 
 echo "+ populate fs image" >> $seqres.full
-_scratch_populate >> $seqres.full
+_scratch_populate >> $seqres.full 2>&1

That's quite an overbroad brush there -- we want any *unexpected* errors to go to the .out file. Given there are five users of setfattr --restore flag:

$ git grep -i attr.*--restore
common/overlay:497:             _getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
common/populate:154:    ) | setfattr --restore -
common/populate:203:            ) | setfattr --restore -
tests/generic/062:189:setfattr -h --restore=$tmp.backup1
tests/xfs/227:75:       $SETFATTR_PROG --restore=$tmp.$1.attrs $2

Maaaaybe this should instead be a targeted wrapper for that?

_setfattr_restore()

{
	$SETFATTR_PROG --restore=- 2> $tmp.setfattr.$$
	local ret=$?
	cat $tmp.setfattr.$$ | sed -e '/--restore=.*unsafe.*without/d' 1>&2
	return $ret
}

--D

Quoted 7 lines
tests/xfs/083 +0 -0
 echo "+ check fs" >> $seqres.full
 _repair_scratch_fs >> $seqres.full 2>&1 || _fail "should pass initial fsck"
Signature · 1 line
2.54.0
#2 lore raw

PATCH v2 1/1 common: strip attr 2.6.0 --restore safety warnings

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 hardening) makes "setfattr --restore" print a warning to stderr when neither -P nor -h is given, claiming it may traverse or dereference symlinks in the dump's pathnames [0]. This warning leaks into test output and breaks generic/062 and xfs/083 (via _scratch_populate).

Add a _setfattr_restore helper that runs "setfattr --restore", filters out just the expected warning line, and preserves any other (unexpected) stderr. Convert the callers in common/populate, common/overlay and generic/062 to use it.

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---
 common/overlay    | 2 +-
 common/populate   | 4 ++--
 common/rc         | 8 ++++++++
 tests/generic/062 | 2 +-
 4 files changed, 12 insertions(+), 4 deletions(-)
common/overlay +1 -1
index d32f3219..73841dd7 100644
@@ -494,7 +494,7 @@ _overlay_trusted_to_user()
 	local dir=$1
 
 	for file in `find $dir`; do
-		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
+		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | _setfattr_restore --restore=-
 		for xattr in `_getfattr --absolute-names -d -m '^trusted.overlay.' $file  | tail -n +2 | cut -d= -f1`; do
 			$SETFATTR_PROG -x $xattr $file;
 		done
common/populate +2 -2
index 1c0dd03e..f7fcd0c3 100644
@@ -151,7 +151,7 @@ __populate_create_attr() {
 		echo "# file: ${name}";
 		seq --format "user.%08g=\"abcdefgh\"" 0 "${nr}"
 		echo
-	) | setfattr --restore -
+	) | _setfattr_restore --restore=-
 
 	test -z "${missing}" && return
 	seq 1 2 "${nr}" | while read d; do
@@ -200,7 +200,7 @@ __populate_xfs_create_btree_attr() {
 			seq --format "user.%08g=\"abcdefgh\"" "${nr}" "$((nr + incr + 1))"
 			echo "user.v$(printf "%.08d" "$nr")=\"${bigval}\""
 			echo
-		) | setfattr --restore -
+		) | _setfattr_restore --restore=-
 	done
 
 	# ... and in the second loop we delete all the remote attrs to
common/rc +8 -0
index 79189e7e..6234a580 100644
@@ -132,6 +132,14 @@ _test_fsxattr_xflag()
 	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
 }
 
+_setfattr_restore()
+{
+	$SETFATTR_PROG "$@" 2> $tmp.setfattr.$$
+	local ret=$?
+	cat $tmp.setfattr.$$ | sed -e '/--restore=.*unsafe.*without/d' 1>&2
+	return $ret
+}
+
 # This test requires extsize support on the  filesystem
 _require_scratch_extsize()
 {
tests/generic/062 +1 -1
index 89659040..3ef96da1 100755
@@ -186,7 +186,7 @@ _create_test_bed
 _extend_test_bed
 
 echo "*** restore everything"
-setfattr -h --restore=$tmp.backup1
+_setfattr_restore -h --restore=$tmp.backup1 2>&1 | _filter_scratch
 _backup $tmp.backup2
 
 echo "AFTER RESTORE" >>$seqres.full
Signature · 1 line
2.54.0
#3 lore raw

Re: [PATCH v2] common: strip attr 2.6.0 --restore safety warnings

Quoted 64 lines · Avinesh Kumar

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 hardening) makes "setfattr --restore" print a warning to stderr when neither -P nor -h is given, claiming it may traverse or dereference symlinks in the dump's pathnames [0]. This warning leaks into test output and breaks generic/062 and xfs/083 (via _scratch_populate).

Add a _setfattr_restore helper that runs "setfattr --restore", filters out just the expected warning line, and preserves any other (unexpected) stderr. Convert the callers in common/populate, common/overlay and generic/062 to use it.

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---
 common/overlay    | 2 +-
 common/populate   | 4 ++--
 common/rc         | 8 ++++++++
 tests/generic/062 | 2 +-
 4 files changed, 12 insertions(+), 4 deletions(-)
common/overlay +1 -1
index d32f3219..73841dd7 100644
@@ -494,7 +494,7 @@ _overlay_trusted_to_user()
 	local dir=$1
 
 	for file in `find $dir`; do
-		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
+		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | _setfattr_restore --restore=-
 		for xattr in `_getfattr --absolute-names -d -m '^trusted.overlay.' $file  | tail -n +2 | cut -d= -f1`; do
 			$SETFATTR_PROG -x $xattr $file;
 		done
common/populate +2 -2
index 1c0dd03e..f7fcd0c3 100644
@@ -151,7 +151,7 @@ __populate_create_attr() {
 		echo "# file: ${name}";
 		seq --format "user.%08g=\"abcdefgh\"" 0 "${nr}"
 		echo
-	) | setfattr --restore -
+	) | _setfattr_restore --restore=-
 
 	test -z "${missing}" && return
 	seq 1 2 "${nr}" | while read d; do
@@ -200,7 +200,7 @@ __populate_xfs_create_btree_attr() {
 			seq --format "user.%08g=\"abcdefgh\"" "${nr}" "$((nr + incr + 1))"
 			echo "user.v$(printf "%.08d" "$nr")=\"${bigval}\""
 			echo
-		) | setfattr --restore -
+		) | _setfattr_restore --restore=-
 	done
 
 	# ... and in the second loop we delete all the remote attrs to
common/rc +0 -0
index 79189e7e..6234a580 100644

common/rc _test_fsxattr_xflag() · line 137

Quoted 6 lines
common/rc +3 -0
@@ -132,6 +132,14 @@ _test_fsxattr_xflag()
 	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
 }
 
+_setfattr_restore()
+{
+	$SETFATTR_PROG "$@" 2> $tmp.setfattr.$$

Hrm... I suppose if you're going to allow any arguments to setfattr (and not specifically require --restore=) then the helper ought to be called _setfattr.

Other than naming, the changes look ok to me.

--D

Quoted 24 lines
common/rc +5 -0
+	local ret=$?
+	cat $tmp.setfattr.$$ | sed -e '/--restore=.*unsafe.*without/d' 1>&2
+	return $ret
+}
+
 # This test requires extsize support on the  filesystem
 _require_scratch_extsize()
 {
tests/generic/062 +1 -1
index 89659040..3ef96da1 100755
@@ -186,7 +186,7 @@ _create_test_bed
 _extend_test_bed
 
 echo "*** restore everything"
-setfattr -h --restore=$tmp.backup1
+_setfattr_restore -h --restore=$tmp.backup1 2>&1 | _filter_scratch
 _backup $tmp.backup2
 
 echo "AFTER RESTORE" >>$seqres.full
Signature · 1 line
2.54.0
#4 lore raw

Re: [PATCH v2] common: strip attr 2.6.0 --restore safety warnings

Hello Darrick,

Thanks for the review.

Quoted 76 lines · Darrick J. Wong
Quoted 64 lines · Avinesh Kumar

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 hardening) makes "setfattr --restore" print a warning to stderr when neither -P nor -h is given, claiming it may traverse or dereference symlinks in the dump's pathnames [0]. This warning leaks into test output and breaks generic/062 and xfs/083 (via _scratch_populate).

Add a _setfattr_restore helper that runs "setfattr --restore", filters out just the expected warning line, and preserves any other (unexpected) stderr. Convert the callers in common/populate, common/overlay and generic/062 to use it.

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---
  common/overlay    | 2 +-
  common/populate   | 4 ++--
  common/rc         | 8 ++++++++
  tests/generic/062 | 2 +-
  4 files changed, 12 insertions(+), 4 deletions(-)
common/overlay +1 -1
index d32f3219..73841dd7 100644
@@ -494,7 +494,7 @@ _overlay_trusted_to_user()
  	local dir=$1
 
  	for file in `find $dir`; do
-		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
+		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | _setfattr_restore --restore=-
  		for xattr in `_getfattr --absolute-names -d -m '^trusted.overlay.' $file  | tail -n +2 | cut -d= -f1`; do
  			$SETFATTR_PROG -x $xattr $file;
  		done
common/populate +2 -2
index 1c0dd03e..f7fcd0c3 100644
@@ -151,7 +151,7 @@ __populate_create_attr() {
  		echo "# file: ${name}";
  		seq --format "user.%08g=\"abcdefgh\"" 0 "${nr}"
  		echo
-	) | setfattr --restore -
+	) | _setfattr_restore --restore=-
 
  	test -z "${missing}" && return
  	seq 1 2 "${nr}" | while read d; do
@@ -200,7 +200,7 @@ __populate_xfs_create_btree_attr() {
  			seq --format "user.%08g=\"abcdefgh\"" "${nr}" "$((nr + incr + 1))"
  			echo "user.v$(printf "%.08d" "$nr")=\"${bigval}\""
  			echo
-		) | setfattr --restore -
+		) | _setfattr_restore --restore=-
  	done
 
  	# ... and in the second loop we delete all the remote attrs to
common/rc +0 -0
index 79189e7e..6234a580 100644

common/rc _test_fsxattr_xflag() · line 137

Quoted 6 lines
common/rc +3 -0
@@ -132,6 +132,14 @@ _test_fsxattr_xflag()
  	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
  }
 
+_setfattr_restore()
+{
+	$SETFATTR_PROG "$@" 2> $tmp.setfattr.$$

Hrm... I suppose if you're going to allow any arguments to setfattr (and not specifically require --restore=) then the helper ought to be called _setfattr.

Quoted 1 line

Other than naming, the changes look ok to me.

I made wrapper to take argument (instead of hardcoding --restore=-) to handle the generic/062 case where it restores from a file and also have '-h'. And I kept helper name '_setfattr_restore' as it is still entirely restore specific but I leave that up to you. Please let me know if I should send revised patch.

Quoted 23 lines

--D

Quoted 20 lines
common/rc +5 -0
+	local ret=$?
+	cat $tmp.setfattr.$$ | sed -e '/--restore=.*unsafe.*without/d' 1>&2
+	return $ret
+}
+
  # This test requires extsize support on the  filesystem
  _require_scratch_extsize()
  {
tests/generic/062 +1 -1
index 89659040..3ef96da1 100755
@@ -186,7 +186,7 @@ _create_test_bed
  _extend_test_bed
 
  echo "*** restore everything"
-setfattr -h --restore=$tmp.backup1
+_setfattr_restore -h --restore=$tmp.backup1 2>&1 | _filter_scratch
  _backup $tmp.backup2
 
Quoted 4 lines
Quoted 4 lines
tests/generic/062 +0 -0
  echo "AFTER RESTORE" >>$seqres.full
Signature · 1 line
2.54.0

Regards,
Avinesh

#5 lore raw

Re: [PATCH v2] common: strip attr 2.6.0 --restore safety warnings

In reply to Avinesh Kumar
Quoted 64 lines · Avinesh Kumar

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 hardening) makes "setfattr --restore" print a warning to stderr when neither -P nor -h is given, claiming it may traverse or dereference symlinks in the dump's pathnames [0]. This warning leaks into test output and breaks generic/062 and xfs/083 (via _scratch_populate).

Add a _setfattr_restore helper that runs "setfattr --restore", filters out just the expected warning line, and preserves any other (unexpected) stderr. Convert the callers in common/populate, common/overlay and generic/062 to use it.

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---
 common/overlay    | 2 +-
 common/populate   | 4 ++--
 common/rc         | 8 ++++++++
 tests/generic/062 | 2 +-
 4 files changed, 12 insertions(+), 4 deletions(-)
common/overlay +1 -1
index d32f3219..73841dd7 100644
@@ -494,7 +494,7 @@ _overlay_trusted_to_user()
 	local dir=$1
 
 	for file in `find $dir`; do
-		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
+		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | _setfattr_restore --restore=-
 		for xattr in `_getfattr --absolute-names -d -m '^trusted.overlay.' $file  | tail -n +2 | cut -d= -f1`; do
 			$SETFATTR_PROG -x $xattr $file;
 		done
common/populate +2 -2
index 1c0dd03e..f7fcd0c3 100644
@@ -151,7 +151,7 @@ __populate_create_attr() {
 		echo "# file: ${name}";
 		seq --format "user.%08g=\"abcdefgh\"" 0 "${nr}"
 		echo
-	) | setfattr --restore -
+	) | _setfattr_restore --restore=-
 
 	test -z "${missing}" && return
 	seq 1 2 "${nr}" | while read d; do
@@ -200,7 +200,7 @@ __populate_xfs_create_btree_attr() {
 			seq --format "user.%08g=\"abcdefgh\"" "${nr}" "$((nr + incr + 1))"
 			echo "user.v$(printf "%.08d" "$nr")=\"${bigval}\""
 			echo
-		) | setfattr --restore -
+		) | _setfattr_restore --restore=-
 	done
 
 	# ... and in the second loop we delete all the remote attrs to
common/rc +0 -0
index 79189e7e..6234a580 100644

common/rc _test_fsxattr_xflag() · line 137

Quoted 6 lines
common/rc +3 -0
@@ -132,6 +132,14 @@ _test_fsxattr_xflag()
 	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
 }
 
+_setfattr_restore()
+{
+	$SETFATTR_PROG "$@" 2> $tmp.setfattr.$$

If the function name is _setfattr_restore (not _setfattr), I think it should run $SETFATTR_PROG --restore, rather than a common $SETFATTR_PROG command.

Thanks,
Zorro

Quoted 24 lines
common/rc +5 -0
+	local ret=$?
+	cat $tmp.setfattr.$$ | sed -e '/--restore=.*unsafe.*without/d' 1>&2
+	return $ret
+}
+
 # This test requires extsize support on the  filesystem
 _require_scratch_extsize()
 {
tests/generic/062 +1 -1
index 89659040..3ef96da1 100755
@@ -186,7 +186,7 @@ _create_test_bed
 _extend_test_bed
 
 echo "*** restore everything"
-setfattr -h --restore=$tmp.backup1
+_setfattr_restore -h --restore=$tmp.backup1 2>&1 | _filter_scratch
 _backup $tmp.backup2
 
 echo "AFTER RESTORE" >>$seqres.full
Signature · 1 line
2.54.0
#6 lore raw

PATCH v3 1/1 common: strip attr 2.6.0 --restore safety warnings

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 hardening) makes "setfattr --restore" print a warning to stderr when options -P and -h are not given, claiming it may traverse or dereference symlinks in the dump's pathnames [0]. This warning leaks into test output and breaks generic/062 and xfs/083 (via _scratch_populate).

Add a _setfattr_restore helper that takes the restore source as its first argument, filters out just the expected warning line, and preserves any other (unexpected) stderr. Convert the callers in common/populate, common/overlay and generic/062 to use it.

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---
 common/overlay    |  2 +-
 common/populate   |  4 ++--
 common/rc         | 15 +++++++++++++++
 tests/generic/062 |  2 +-
 4 files changed, 19 insertions(+), 4 deletions(-)
common/overlay +1 -1
index d32f3219..8e89d6e4 100644
@@ -494,7 +494,7 @@ _overlay_trusted_to_user()
 	local dir=$1
 
 	for file in `find $dir`; do
-		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
+		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | _setfattr_restore -
 		for xattr in `_getfattr --absolute-names -d -m '^trusted.overlay.' $file  | tail -n +2 | cut -d= -f1`; do
 			$SETFATTR_PROG -x $xattr $file;
 		done
common/populate +2 -2
index 1c0dd03e..f3672c1a 100644
@@ -151,7 +151,7 @@ __populate_create_attr() {
 		echo "# file: ${name}";
 		seq --format "user.%08g=\"abcdefgh\"" 0 "${nr}"
 		echo
-	) | setfattr --restore -
+	) | _setfattr_restore -
 
 	test -z "${missing}" && return
 	seq 1 2 "${nr}" | while read d; do
@@ -200,7 +200,7 @@ __populate_xfs_create_btree_attr() {
 			seq --format "user.%08g=\"abcdefgh\"" "${nr}" "$((nr + incr + 1))"
 			echo "user.v$(printf "%.08d" "$nr")=\"${bigval}\""
 			echo
-		) | setfattr --restore -
+		) | _setfattr_restore -
 	done
 
 	# ... and in the second loop we delete all the remote attrs to
common/rc +15 -0
index 79189e7e..38b77bef 100644
@@ -132,6 +132,21 @@ _test_fsxattr_xflag()
 	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
 }
 
+# Restore xattrs from a getfattr-style dump given as $1 (a dump file, or "-"
+# for stdin); any extra setfattr options follow.  attr 2.6.0 (CVE-2026-54371)
+# makes --restore warn unless both -P and -h are given, so filter out just
+# those warning lines, keep other unexpected stderr.
+_setfattr_restore()
+{
+	local restore_from="$1"
+	shift
+
+	$SETFATTR_PROG "$@" --restore="$restore_from" 2> $tmp.setfattr
+	local ret=$?
+	sed -e '/--restore=.*unsafe.*without/d' "$tmp.setfattr" 1>&2
+	return $ret
+}
+
 # This test requires extsize support on the  filesystem
 _require_scratch_extsize()
 {
tests/generic/062 +1 -1
index 89659040..845d62f2 100755
@@ -186,7 +186,7 @@ _create_test_bed
 _extend_test_bed
 
 echo "*** restore everything"
-setfattr -h --restore=$tmp.backup1
+_setfattr_restore "$tmp.backup1" -h 2>&1 | _filter_scratch
 _backup $tmp.backup2
 
 echo "AFTER RESTORE" >>$seqres.full
Signature · 1 line
2.55.0
Reviewed-by on v3 1/1
#7 lore raw

Re: [PATCH v3] common: strip attr 2.6.0 --restore safety warnings

Quoted 71 lines · Avinesh Kumar

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 hardening) makes "setfattr --restore" print a warning to stderr when options -P and -h are not given, claiming it may traverse or dereference symlinks in the dump's pathnames [0]. This warning leaks into test output and breaks generic/062 and xfs/083 (via _scratch_populate).

Add a _setfattr_restore helper that takes the restore source as its first argument, filters out just the expected warning line, and preserves any other (unexpected) stderr. Convert the callers in common/populate, common/overlay and generic/062 to use it.

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---
 common/overlay    |  2 +-
 common/populate   |  4 ++--
 common/rc         | 15 +++++++++++++++
 tests/generic/062 |  2 +-
 4 files changed, 19 insertions(+), 4 deletions(-)
common/overlay +1 -1
index d32f3219..8e89d6e4 100644
@@ -494,7 +494,7 @@ _overlay_trusted_to_user()
 	local dir=$1
 
 	for file in `find $dir`; do
-		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
+		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | _setfattr_restore -
 		for xattr in `_getfattr --absolute-names -d -m '^trusted.overlay.' $file  | tail -n +2 | cut -d= -f1`; do
 			$SETFATTR_PROG -x $xattr $file;
 		done
common/populate +2 -2
index 1c0dd03e..f3672c1a 100644
@@ -151,7 +151,7 @@ __populate_create_attr() {
 		echo "# file: ${name}";
 		seq --format "user.%08g=\"abcdefgh\"" 0 "${nr}"
 		echo
-	) | setfattr --restore -
+	) | _setfattr_restore -
 
 	test -z "${missing}" && return
 	seq 1 2 "${nr}" | while read d; do
@@ -200,7 +200,7 @@ __populate_xfs_create_btree_attr() {
 			seq --format "user.%08g=\"abcdefgh\"" "${nr}" "$((nr + incr + 1))"
 			echo "user.v$(printf "%.08d" "$nr")=\"${bigval}\""
 			echo
-		) | setfattr --restore -
+		) | _setfattr_restore -
 	done
 
 	# ... and in the second loop we delete all the remote attrs to
common/rc +4 -0
index 79189e7e..38b77bef 100644
@@ -132,6 +132,21 @@ _test_fsxattr_xflag()
 	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
 }
 
+# Restore xattrs from a getfattr-style dump given as $1 (a dump file, or "-"
+# for stdin); any extra setfattr options follow.  attr 2.6.0 (CVE-2026-54371)
+# makes --restore warn unless both -P and -h are given, so filter out just
+# those warning lines, keep other unexpected stderr.

common/rc _test_fsxattr_xflag() · line 148

Quoted 10 lines
common/rc +10 -0
+_setfattr_restore()
+{
+	local restore_from="$1"
+	shift
+
+	$SETFATTR_PROG "$@" --restore="$restore_from" 2> $tmp.setfattr
+	local ret=$?
+	sed -e '/--restore=.*unsafe.*without/d' "$tmp.setfattr" 1>&2
+	return $ret
+}

Looks good to me,

--D

Quoted 20 lines
common/rc +1 -0
+
 # This test requires extsize support on the  filesystem
 _require_scratch_extsize()
 {
tests/generic/062 +1 -1
index 89659040..845d62f2 100755
@@ -186,7 +186,7 @@ _create_test_bed
 _extend_test_bed
 
 echo "*** restore everything"
-setfattr -h --restore=$tmp.backup1
+_setfattr_restore "$tmp.backup1" -h 2>&1 | _filter_scratch
 _backup $tmp.backup2
 
 echo "AFTER RESTORE" >>$seqres.full
Signature · 1 line
2.55.0
#8 lore raw

Re: [PATCH v3] common: strip attr 2.6.0 --restore safety warnings

In reply to Avinesh Kumar
Quoted 13 lines · Avinesh Kumar

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 hardening) makes "setfattr --restore" print a warning to stderr when options -P and -h are not given, claiming it may traverse or dereference symlinks in the dump's pathnames [0]. This warning leaks into test output and breaks generic/062 and xfs/083 (via _scratch_populate).

Add a _setfattr_restore helper that takes the restore source as its first argument, filters out just the expected warning line, and preserves any other (unexpected) stderr. Convert the callers in common/populate, common/overlay and generic/062 to use it.

Quoted 5 lines

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---

This patch looks good to me, but I've just merged your patch:

  [PATCH v2] generic/062: filter setfattr --restore symlink-safety warning

as a preliminary fix for g/062. So could you please rebase this patch onto the latest for-next branch, then send again? Thanks a lot!

Quoted 83 lines
 common/overlay    |  2 +-
 common/populate   |  4 ++--
 common/rc         | 15 +++++++++++++++
 tests/generic/062 |  2 +-
 4 files changed, 19 insertions(+), 4 deletions(-)
common/overlay +1 -1
index d32f3219..8e89d6e4 100644
@@ -494,7 +494,7 @@ _overlay_trusted_to_user()
 	local dir=$1
 
 	for file in `find $dir`; do
-		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
+		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | _setfattr_restore -
 		for xattr in `_getfattr --absolute-names -d -m '^trusted.overlay.' $file  | tail -n +2 | cut -d= -f1`; do
 			$SETFATTR_PROG -x $xattr $file;
 		done
common/populate +2 -2
index 1c0dd03e..f3672c1a 100644
@@ -151,7 +151,7 @@ __populate_create_attr() {
 		echo "# file: ${name}";
 		seq --format "user.%08g=\"abcdefgh\"" 0 "${nr}"
 		echo
-	) | setfattr --restore -
+	) | _setfattr_restore -
 
 	test -z "${missing}" && return
 	seq 1 2 "${nr}" | while read d; do
@@ -200,7 +200,7 @@ __populate_xfs_create_btree_attr() {
 			seq --format "user.%08g=\"abcdefgh\"" "${nr}" "$((nr + incr + 1))"
 			echo "user.v$(printf "%.08d" "$nr")=\"${bigval}\""
 			echo
-		) | setfattr --restore -
+		) | _setfattr_restore -
 	done
 
 	# ... and in the second loop we delete all the remote attrs to
common/rc +15 -0
index 79189e7e..38b77bef 100644
@@ -132,6 +132,21 @@ _test_fsxattr_xflag()
 	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
 }
 
+# Restore xattrs from a getfattr-style dump given as $1 (a dump file, or "-"
+# for stdin); any extra setfattr options follow.  attr 2.6.0 (CVE-2026-54371)
+# makes --restore warn unless both -P and -h are given, so filter out just
+# those warning lines, keep other unexpected stderr.
+_setfattr_restore()
+{
+	local restore_from="$1"
+	shift
+
+	$SETFATTR_PROG "$@" --restore="$restore_from" 2> $tmp.setfattr
+	local ret=$?
+	sed -e '/--restore=.*unsafe.*without/d' "$tmp.setfattr" 1>&2
+	return $ret
+}
+
 # This test requires extsize support on the  filesystem
 _require_scratch_extsize()
 {
tests/generic/062 +1 -1
index 89659040..845d62f2 100755
@@ -186,7 +186,7 @@ _create_test_bed
 _extend_test_bed
 
 echo "*** restore everything"
-setfattr -h --restore=$tmp.backup1
+_setfattr_restore "$tmp.backup1" -h 2>&1 | _filter_scratch
 _backup $tmp.backup2
 
 echo "AFTER RESTORE" >>$seqres.full
Signature · 1 line
2.55.0
#9 lore raw

PATCH v4 1/1 common: strip attr 2.6.0 --restore safety warnings

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 hardening) makes "setfattr --restore" print a warning to stderr when options -P and -h are not given, claiming it may traverse or dereference symlinks in the dump's pathnames [0]. This warning leaks into test output and breaks generic/062 and xfs/083 (via _scratch_populate).

Add a _setfattr_restore helper that takes the restore source as its first argument, filters out just the expected warning line, and preserves any other (unexpected) stderr. Convert the callers in common/populate, common/overlay and generic/062 to use it.

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---
 common/overlay    |  2 +-
 common/populate   |  4 ++--
 common/rc         | 15 +++++++++++++++
 tests/generic/062 |  9 ++-------
 4 files changed, 20 insertions(+), 10 deletions(-)
common/overlay +1 -1
index d32f3219..8e89d6e4 100644
@@ -494,7 +494,7 @@ _overlay_trusted_to_user()
 	local dir=$1
 
 	for file in `find $dir`; do
-		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
+		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | _setfattr_restore -
 		for xattr in `_getfattr --absolute-names -d -m '^trusted.overlay.' $file  | tail -n +2 | cut -d= -f1`; do
 			$SETFATTR_PROG -x $xattr $file;
 		done
common/populate +2 -2
index 1c0dd03e..f3672c1a 100644
@@ -151,7 +151,7 @@ __populate_create_attr() {
 		echo "# file: ${name}";
 		seq --format "user.%08g=\"abcdefgh\"" 0 "${nr}"
 		echo
-	) | setfattr --restore -
+	) | _setfattr_restore -
 
 	test -z "${missing}" && return
 	seq 1 2 "${nr}" | while read d; do
@@ -200,7 +200,7 @@ __populate_xfs_create_btree_attr() {
 			seq --format "user.%08g=\"abcdefgh\"" "${nr}" "$((nr + incr + 1))"
 			echo "user.v$(printf "%.08d" "$nr")=\"${bigval}\""
 			echo
-		) | setfattr --restore -
+		) | _setfattr_restore -
 	done
 
 	# ... and in the second loop we delete all the remote attrs to
common/rc +15 -0
index 106f044a..f5673113 100644
@@ -132,6 +132,21 @@ _test_fsxattr_xflag()
 	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
 }
 
+# Restore xattrs from a getfattr-style dump given as $1 (a dump file, or "-"
+# for stdin); any extra setfattr options follow.  attr 2.6.0 (CVE-2026-54371)
+# makes --restore warn unless both -P and -h are given, so filter out just
+# those warning lines, keep other unexpected stderr.
+_setfattr_restore()
+{
+	local restore_from="$1"
+	shift
+
+	$SETFATTR_PROG "$@" --restore="$restore_from" 2> $tmp.setfattr
+	local ret=$?
+	sed -e '/--restore=.*unsafe.*without/d' "$tmp.setfattr" 1>&2
+	return $ret
+}
+
 # This test requires extsize support on the  filesystem
 _require_scratch_extsize()
 {
tests/generic/062 +2 -7
index ddf0a478..845d62f2 100755
@@ -30,12 +30,7 @@ getfattr()
 
 setfattr()
 {
-    # attr >= 2.6.0 (CVE-2026-54371 fix) warns that "setfattr --restore" without
-    # -P/--physical is unsafe because it can traverse symlinks. Older attr does
-    # not accept -P, so just filter the warning to stay version-agnostic.
-    $SETFATTR_PROG $@ 2>&1 | \
-        sed -e '/^Warning: option --restore=file is unsafe without option/d' | \
-        _filter_scratch
+    $SETFATTR_PROG $@ 2>&1 | _filter_scratch
 }
 
 _create_test_bed()
@@ -191,7 +186,7 @@ _create_test_bed
 _extend_test_bed
 
 echo "*** restore everything"
-setfattr -h --restore=$tmp.backup1
+_setfattr_restore "$tmp.backup1" -h 2>&1 | _filter_scratch
 _backup $tmp.backup2
 
 echo "AFTER RESTORE" >>$seqres.full
Signature · 1 line
2.55.0
#10 lore raw

Re: [PATCH v4] common: strip attr 2.6.0 --restore safety warnings

Quoted 71 lines · Avinesh Kumar

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 hardening) makes "setfattr --restore" print a warning to stderr when options -P and -h are not given, claiming it may traverse or dereference symlinks in the dump's pathnames [0]. This warning leaks into test output and breaks generic/062 and xfs/083 (via _scratch_populate).

Add a _setfattr_restore helper that takes the restore source as its first argument, filters out just the expected warning line, and preserves any other (unexpected) stderr. Convert the callers in common/populate, common/overlay and generic/062 to use it.

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---
 common/overlay    |  2 +-
 common/populate   |  4 ++--
 common/rc         | 15 +++++++++++++++
 tests/generic/062 |  9 ++-------
 4 files changed, 20 insertions(+), 10 deletions(-)
common/overlay +1 -1
index d32f3219..8e89d6e4 100644
@@ -494,7 +494,7 @@ _overlay_trusted_to_user()
 	local dir=$1
 
 	for file in `find $dir`; do
-		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
+		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | _setfattr_restore -
 		for xattr in `_getfattr --absolute-names -d -m '^trusted.overlay.' $file  | tail -n +2 | cut -d= -f1`; do
 			$SETFATTR_PROG -x $xattr $file;
 		done
common/populate +2 -2
index 1c0dd03e..f3672c1a 100644
@@ -151,7 +151,7 @@ __populate_create_attr() {
 		echo "# file: ${name}";
 		seq --format "user.%08g=\"abcdefgh\"" 0 "${nr}"
 		echo
-	) | setfattr --restore -
+	) | _setfattr_restore -
 
 	test -z "${missing}" && return
 	seq 1 2 "${nr}" | while read d; do
@@ -200,7 +200,7 @@ __populate_xfs_create_btree_attr() {
 			seq --format "user.%08g=\"abcdefgh\"" "${nr}" "$((nr + incr + 1))"
 			echo "user.v$(printf "%.08d" "$nr")=\"${bigval}\""
 			echo
-		) | setfattr --restore -
+		) | _setfattr_restore -
 	done
 
 	# ... and in the second loop we delete all the remote attrs to
common/rc +3 -0
index 106f044a..f5673113 100644
@@ -132,6 +132,21 @@ _test_fsxattr_xflag()
 	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
 }
 
+# Restore xattrs from a getfattr-style dump given as $1 (a dump file, or "-"
+# for stdin); any extra setfattr options follow.  attr 2.6.0 (CVE-2026-54371)
+# makes --restore warn unless both -P and -h are given, so filter out just

common/rc _test_fsxattr_xflag() · line 147

Quoted 10 lines
common/rc +10 -0
+# those warning lines, keep other unexpected stderr.
+_setfattr_restore()
+{
+	local restore_from="$1"
+	shift
+
+	$SETFATTR_PROG "$@" --restore="$restore_from" 2> $tmp.setfattr
+	local ret=$?
+	sed -e '/--restore=.*unsafe.*without/d' "$tmp.setfattr" 1>&2
+	return $ret

How about:

  $SETFATTR_PROG "$@" --restore="$restore_from" 2>&1 | \
      sed -e '/--restore=.*unsafe.*without/d'
  return ${PIPESTATUS[0]}

Thanks,
Zorro

Quoted 35 lines
common/rc +2 -0
+}
+
 # This test requires extsize support on the  filesystem
 _require_scratch_extsize()
 {
tests/generic/062 +2 -7
index ddf0a478..845d62f2 100755
@@ -30,12 +30,7 @@ getfattr()
 
 setfattr()
 {
-    # attr >= 2.6.0 (CVE-2026-54371 fix) warns that "setfattr --restore" without
-    # -P/--physical is unsafe because it can traverse symlinks. Older attr does
-    # not accept -P, so just filter the warning to stay version-agnostic.
-    $SETFATTR_PROG $@ 2>&1 | \
-        sed -e '/^Warning: option --restore=file is unsafe without option/d' | \
-        _filter_scratch
+    $SETFATTR_PROG $@ 2>&1 | _filter_scratch
 }
 
 _create_test_bed()
@@ -191,7 +186,7 @@ _create_test_bed
 _extend_test_bed
 
 echo "*** restore everything"
-setfattr -h --restore=$tmp.backup1
+_setfattr_restore "$tmp.backup1" -h 2>&1 | _filter_scratch
 _backup $tmp.backup2
 
 echo "AFTER RESTORE" >>$seqres.full
Signature · 1 line
2.55.0
#11 lore raw

PATCH v5 1/1 common: strip attr 2.6.0 --restore safety warnings

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 hardening) makes "setfattr --restore" print a warning to stderr when options -P and -h are not given, claiming it may traverse or dereference symlinks in the dump's pathnames [0]. This warning leaks into test output and breaks generic/062 and xfs/083 (via _scratch_populate).

Add a _setfattr_restore helper that takes the restore source as its first argument, filters out just the expected warning line, and preserves any other (unexpected) stderr. Convert the callers in common/populate, common/overlay and generic/062 to use it.

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---
 common/overlay    |  2 +-
 common/populate   |  4 ++--
 common/rc         | 14 ++++++++++++++
 tests/generic/062 |  9 ++-------
 4 files changed, 19 insertions(+), 10 deletions(-)
common/overlay +1 -1
index d32f3219..8e89d6e4 100644
@@ -494,7 +494,7 @@ _overlay_trusted_to_user()
 	local dir=$1
 
 	for file in `find $dir`; do
-		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
+		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | _setfattr_restore -
 		for xattr in `_getfattr --absolute-names -d -m '^trusted.overlay.' $file  | tail -n +2 | cut -d= -f1`; do
 			$SETFATTR_PROG -x $xattr $file;
 		done
common/populate +2 -2
index 1c0dd03e..f3672c1a 100644
@@ -151,7 +151,7 @@ __populate_create_attr() {
 		echo "# file: ${name}";
 		seq --format "user.%08g=\"abcdefgh\"" 0 "${nr}"
 		echo
-	) | setfattr --restore -
+	) | _setfattr_restore -
 
 	test -z "${missing}" && return
 	seq 1 2 "${nr}" | while read d; do
@@ -200,7 +200,7 @@ __populate_xfs_create_btree_attr() {
 			seq --format "user.%08g=\"abcdefgh\"" "${nr}" "$((nr + incr + 1))"
 			echo "user.v$(printf "%.08d" "$nr")=\"${bigval}\""
 			echo
-		) | setfattr --restore -
+		) | _setfattr_restore -
 	done
 
 	# ... and in the second loop we delete all the remote attrs to
common/rc +14 -0
index 8add0eed..ccbc02b8 100644
@@ -132,6 +132,20 @@ _test_fsxattr_xflag()
 	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
 }
 
+# Restore xattrs from a getfattr-style dump given as $1 (a dump file, or "-"
+# for stdin); any extra setfattr options follow.  attr 2.6.0 (CVE-2026-54371)
+# makes --restore warn unless both -P and -h are given, so filter out just
+# those warning lines, keep other unexpected stderr.
+_setfattr_restore()
+{
+	local restore_from="$1"
+	shift
+
+	$SETFATTR_PROG "$@" --restore="$restore_from" 2>&1 | \
+		sed -e '/--restore=.*unsafe.*without/d'
+	return ${PIPESTATUS[0]}
+}
+
 # This test requires extsize support on the  filesystem
 _require_scratch_extsize()
 {
tests/generic/062 +2 -7
index ddf0a478..845d62f2 100755
@@ -30,12 +30,7 @@ getfattr()
 
 setfattr()
 {
-    # attr >= 2.6.0 (CVE-2026-54371 fix) warns that "setfattr --restore" without
-    # -P/--physical is unsafe because it can traverse symlinks. Older attr does
-    # not accept -P, so just filter the warning to stay version-agnostic.
-    $SETFATTR_PROG $@ 2>&1 | \
-        sed -e '/^Warning: option --restore=file is unsafe without option/d' | \
-        _filter_scratch
+    $SETFATTR_PROG $@ 2>&1 | _filter_scratch
 }
 
 _create_test_bed()
@@ -191,7 +186,7 @@ _create_test_bed
 _extend_test_bed
 
 echo "*** restore everything"
-setfattr -h --restore=$tmp.backup1
+_setfattr_restore "$tmp.backup1" -h 2>&1 | _filter_scratch
 _backup $tmp.backup2
 
 echo "AFTER RESTORE" >>$seqres.full
Signature · 1 line
2.55.0
Reviewed-by on v5 1/1
#12 lore raw

Re: [PATCH v5] common: strip attr 2.6.0 --restore safety warnings

Quoted 13 lines · Avinesh Kumar

From: Avinesh Kumar <[email protected]>

attr 2.6.0 (CVE-2026-54371 hardening) makes "setfattr --restore" print a warning to stderr when options -P and -h are not given, claiming it may traverse or dereference symlinks in the dump's pathnames [0]. This warning leaks into test output and breaks generic/062 and xfs/083 (via _scratch_populate).

Add a _setfattr_restore helper that takes the restore source as its first argument, filters out just the expected warning line, and preserves any other (unexpected) stderr. Convert the callers in common/populate, common/overlay and generic/062 to use it.

Quoted 6 lines

[0] https://cgit.git.savannah.nongnu.org/cgit/attr.git/commit/?id=3fb06b9ba314d37035d0877e6de313de754f1ac8

---

Thanks for this updating, this version is good to me now.

Quoted 96 lines
 common/overlay    |  2 +-
 common/populate   |  4 ++--
 common/rc         | 14 ++++++++++++++
 tests/generic/062 |  9 ++-------
 4 files changed, 19 insertions(+), 10 deletions(-)
common/overlay +1 -1
index d32f3219..8e89d6e4 100644
@@ -494,7 +494,7 @@ _overlay_trusted_to_user()
 	local dir=$1
 
 	for file in `find $dir`; do
-		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | $SETFATTR_PROG --restore=-
+		_getfattr --absolute-names -d -m '^trusted.overlay.(redirect|metacopy)$' $file  | sed 's/^trusted/user/' | _setfattr_restore -
 		for xattr in `_getfattr --absolute-names -d -m '^trusted.overlay.' $file  | tail -n +2 | cut -d= -f1`; do
 			$SETFATTR_PROG -x $xattr $file;
 		done
common/populate +2 -2
index 1c0dd03e..f3672c1a 100644
@@ -151,7 +151,7 @@ __populate_create_attr() {
 		echo "# file: ${name}";
 		seq --format "user.%08g=\"abcdefgh\"" 0 "${nr}"
 		echo
-	) | setfattr --restore -
+	) | _setfattr_restore -
 
 	test -z "${missing}" && return
 	seq 1 2 "${nr}" | while read d; do
@@ -200,7 +200,7 @@ __populate_xfs_create_btree_attr() {
 			seq --format "user.%08g=\"abcdefgh\"" "${nr}" "$((nr + incr + 1))"
 			echo "user.v$(printf "%.08d" "$nr")=\"${bigval}\""
 			echo
-		) | setfattr --restore -
+		) | _setfattr_restore -
 	done
 
 	# ... and in the second loop we delete all the remote attrs to
common/rc +14 -0
index 8add0eed..ccbc02b8 100644
@@ -132,6 +132,20 @@ _test_fsxattr_xflag()
 	grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
 }
 
+# Restore xattrs from a getfattr-style dump given as $1 (a dump file, or "-"
+# for stdin); any extra setfattr options follow.  attr 2.6.0 (CVE-2026-54371)
+# makes --restore warn unless both -P and -h are given, so filter out just
+# those warning lines, keep other unexpected stderr.
+_setfattr_restore()
+{
+	local restore_from="$1"
+	shift
+
+	$SETFATTR_PROG "$@" --restore="$restore_from" 2>&1 | \
+		sed -e '/--restore=.*unsafe.*without/d'
+	return ${PIPESTATUS[0]}
+}
+
 # This test requires extsize support on the  filesystem
 _require_scratch_extsize()
 {
tests/generic/062 +2 -7
index ddf0a478..845d62f2 100755
@@ -30,12 +30,7 @@ getfattr()
 
 setfattr()
 {
-    # attr >= 2.6.0 (CVE-2026-54371 fix) warns that "setfattr --restore" without
-    # -P/--physical is unsafe because it can traverse symlinks. Older attr does
-    # not accept -P, so just filter the warning to stay version-agnostic.
-    $SETFATTR_PROG $@ 2>&1 | \
-        sed -e '/^Warning: option --restore=file is unsafe without option/d' | \
-        _filter_scratch
+    $SETFATTR_PROG $@ 2>&1 | _filter_scratch
 }
 
 _create_test_bed()
@@ -191,7 +186,7 @@ _create_test_bed
 _extend_test_bed
 
 echo "*** restore everything"
-setfattr -h --restore=$tmp.backup1
+_setfattr_restore "$tmp.backup1" -h 2>&1 | _filter_scratch
 _backup $tmp.backup2
 
 echo "AFTER RESTORE" >>$seqres.full
Signature · 1 line
2.55.0