From 50b1825e409ce2ee5f62013b55fe05933a847818 Mon Sep 17 00:00:00 2001 From: liuh Date: Wed, 12 Nov 2025 14:51:12 +0800 Subject: [PATCH] xfs_repair: fix stupid argument error in verify_inode_chunk (cherry picked from commit 6cb57573e0cbee1698ed1f84d86db30afd68153f) --- ...tupid-argument-error-in-verify_inode.patch | 48 +++++++++++++++++++ xfsprogs.spec | 6 ++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 0011-xfs_repair-fix-stupid-argument-error-in-verify_inode.patch diff --git a/0011-xfs_repair-fix-stupid-argument-error-in-verify_inode.patch b/0011-xfs_repair-fix-stupid-argument-error-in-verify_inode.patch new file mode 100644 index 0000000..e857cb1 --- /dev/null +++ b/0011-xfs_repair-fix-stupid-argument-error-in-verify_inode.patch @@ -0,0 +1,48 @@ +From 06adb3cb38beb304b7b1f002de95e59cfa9098fb Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Fri, 21 Mar 2025 09:32:17 -0700 +Subject: xfs_repair: fix stupid argument error in verify_inode_chunk + +An arm64 VM running fstests with 64k fsblock size blew up the test +filesystem when the OOM killer whacked xfs_repair as it was rebuilding a +sample filesystem. A subsequent attempt by fstests to repair the +filesystem printed stuff like this: + +inode rec for ino 39144576 (1/5590144) overlaps existing rec (start 1/5590144) +inode rec for ino 39144640 (1/5590208) overlaps existing rec (start 1/5590208) + +followed by a lot of errors such as: + +cannot read agbno (1/5590208), disk block 734257664 +xfs_repair: error - read only 0 of 65536 bytes + +Here we're feeding per-AG inode numbers into a block reading function as +if it were a per-AG block number. This is wrong by a factor of 128x so +we read past the end of the filesystem. Worse yet, the buffer cache +fills up memory and thus the second repair process is also OOM killed. +The filesystem is not fixed. + +Cc: linux-xfs@vger.kernel.org # v3.1.8 +Fixes: 0553a94f522c17 ("repair: kill check_inode_block") +Signed-off-by: Darrick J. Wong +Reviewed-by: Christoph Hellwig +--- + repair/dino_chunks.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/repair/dino_chunks.c b/repair/dino_chunks.c +index 1717568..6d30e5d 100644 +--- a/repair/dino_chunks.c ++++ b/repair/dino_chunks.c +@@ -129,7 +129,7 @@ verify_inode_chunk(xfs_mount_t *mp, + if (igeo->ialloc_blks == 1) { + if (agbno > max_agbno) + return 0; +- if (check_aginode_block(mp, agno, agino) == 0) ++ if (check_aginode_block(mp, agno, agbno) == 0) + return 0; + + pthread_mutex_lock(&ag_locks[agno].lock); +-- +2.43.0 + diff --git a/xfsprogs.spec b/xfsprogs.spec index eadba0e..163be1e 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs Version: 6.6.0 -Release: 11 +Release: 12 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -29,6 +29,7 @@ Patch7: 0007-xfs_scrub-don-t-call-phase_end-if-phase_rusage-was-n.patch Patch8: 0008-mkfs-fix-the-issue-of-maxpct-set-to-0-not-taking-eff.patch Patch9: 0009-xfs_repair-don-t-crash-in-get_inode_parent.patch Patch10: 0010-xfs_repair-don-t-leak-the-rootdir-inode-when-orphana.patch +Patch11: 0011-xfs_repair-fix-stupid-argument-error-in-verify_inode.patch %description xfsprogs are the userspace utilities that manage XFS filesystems. @@ -112,6 +113,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Wed Nov 12 2025 liuh - 6.6.0-12 +- xfs_repair: fix stupid argument error in verify_inode_chunk + * Mon Nov 3 2025 liuh - 6.6.0-11 - xfs_repair: don't leak the rootdir inode when orphanage already exists -- Gitee