* [PATCH] xfs: test a hole in a remote xattr value
@ 2026-12-04 5:09 Kyuwon Cho
2026-12-04 8:28 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Kyuwon Cho @ 2026-12-04 5:09 UTC (permalink / raw)
To: fstests
Cc: linux-xfs, Zorro Lang, Darrick J . Wong, Carlos Maiolino,
Dave Chinner, Christoph Hellwig
Extend a remote xattr value length beyond its mapped blocks with xfs_db
and read the value. The kernel must report metadata corruption instead of
treating the hole as a disk address.
Validated in KVM: the test triggers the warning without the fix and passes
with it.
Signed-off-by: Kyuwon Cho <kyuwon.cho@skku.edu>
---
https://lore.kernel.org/all/179559978502.2875040.12926533524466805036@gmail.com/
This test was written with an LLM-guided test generator's reproducer as
its base.
tests/xfs/674 | 55 +++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/674.out | 2 ++
2 files changed, 57 insertions(+)
create mode 100755 tests/xfs/674
create mode 100644 tests/xfs/674.out
diff --git a/tests/xfs/674 b/tests/xfs/674
new file mode 100755
index 00000000..4962d9ca
--- /dev/null
+++ b/tests/xfs/674
@@ -0,0 +1,55 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Kyuwon Cho. All Rights Reserved.
+#
+# FS QA Test No. 674
+#
+# Make sure that reading a remote xattr whose recorded value is longer than
+# its mapped extent reports corruption without trying to read a hole as a
+# disk address.
+#
+. ./common/preamble
+_begin_fstest auto quick attr
+
+. ./common/filter
+. ./common/attr
+
+_fixed_by_kernel_commit a1c699766280 \
+ "xfs: reject a hole in a remote xattr value"
+
+_require_scratch_nocheck
+_require_scratch_xfs_crc
+_require_attrs
+_require_xfs_db_command "write"
+_require_xfs_db_write_array
+
+export SELINUX_MOUNT_OPTIONS=""
+_xfs_force_no_pptrs
+_scratch_mkfs_xfs >> $seqres.full
+_scratch_mount
+
+valuefile=$SCRATCH_MNT/value
+testfile=$SCRATCH_MNT/file
+$XFS_IO_PROG -f -c 'pwrite -S 0x41 0 16160' $valuefile >> $seqres.full
+touch $testfile
+$ATTR_PROG -s big $testfile < $valuefile > /dev/null
+inum=$(stat -c %i $testfile)
+_scratch_unmount
+
+valuelen=$(_scratch_xfs_get_metadata_field "nvlist[0].valuelen" \
+ "inode $inum" "ablock 0")
+test "$valuelen" = 16160 || \
+ _fail "expected a 16160-byte remote xattr, found $valuelen"
+
+# Extend the recorded value length past the four remote blocks. xfs_db
+# updates the metadata CRC after changing the leaf entry.
+_scratch_xfs_db -x -c "inode $inum" -c 'ablock 0' \
+ -c 'write -d nvlist[0].valuelen 65536' >> $seqres.full
+
+_scratch_mount
+$GETFATTR_PROG -n user.big --only-values $testfile > /dev/null 2>&1
+test $? -ne 0 || echo "corrupt remote xattr was readable"
+_scratch_unmount
+
+echo Silence is golden
+_exit 0
diff --git a/tests/xfs/674.out b/tests/xfs/674.out
new file mode 100644
index 00000000..183d311b
--- /dev/null
+++ b/tests/xfs/674.out
@@ -0,0 +1,2 @@
+QA output created by 674
+Silence is golden
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfs: test a hole in a remote xattr value
2026-12-04 5:09 [PATCH] xfs: test a hole in a remote xattr value Kyuwon Cho
@ 2026-12-04 8:28 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2026-12-04 8:28 UTC (permalink / raw)
To: Kyuwon Cho
Cc: fstests, linux-xfs, Zorro Lang, Darrick J . Wong, Carlos Maiolino,
Dave Chinner, Christoph Hellwig
Looks sane, but I think the sashiko comments are sensible, and
this needs a bit tweaking for the selinux context and formatting
with a given blocksize.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-04 8:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 5:09 [PATCH] xfs: test a hole in a remote xattr value Kyuwon Cho
2026-12-04 8:28 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox