Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/3] xfs: fix NULL deref in log recovery reorder
@ 2026-07-01 15:38 Weiming Shi
  2026-07-01 15:38 ` [PATCH v2 1/3] xfs: drop ASSERT(0) on unrecognized log item type Weiming Shi
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Weiming Shi @ 2026-07-01 15:38 UTC (permalink / raw)
  To: linux-xfs
  Cc: Carlos Maiolino, Darrick J . Wong, Brian Foster,
	Christoph Hellwig, Xiang Mei, Weiming Shi

A crafted XFS image can commit a transaction whose only item is a bare
transaction header (ri_cnt == 0, ri_buf == NULL).
xlog_recover_reorder_trans() then runs ITEM_TYPE() on it and dereferences
the NULL ri_buf, faulting the kernel at mount time.

v1 was a single patch that added the check but kept an ASSERT(0) on the
path and duplicated the sort_list splice.  Per Christoph's review, v2
splits it:

  1: drop the existing ASSERT(0) on an unrecognized item type
  2: move the sort_list splice out of the loop (no functional change)
  3: add the check that rejects a committed item with no regions

Patch 3 also notes that, since the log is CRC-checked, this is a crafted
image rather than media corruption.

Tested on xfs-7.2-fixes with KASAN: the unpatched kernel oopses in
xlog_recover_reorder_trans; the patched kernel fails the mount with
-EFSCORRUPTED and no splat.

Weiming Shi (3):
  xfs: drop ASSERT(0) on unrecognized log item type
  xfs: splice unsorted log items back to the transaction after the loop
  xfs: fail recovery on a committed log item with no regions

 fs/xfs/xfs_log_recover.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-07-02 16:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 15:38 [PATCH v2 0/3] xfs: fix NULL deref in log recovery reorder Weiming Shi
2026-07-01 15:38 ` [PATCH v2 1/3] xfs: drop ASSERT(0) on unrecognized log item type Weiming Shi
2026-07-01 21:41   ` Darrick J. Wong
2026-07-02 10:54   ` Christoph Hellwig
2026-07-01 15:38 ` [PATCH v2 2/3] xfs: splice unsorted log items back to the transaction after the loop Weiming Shi
2026-07-01 21:43   ` Darrick J. Wong
2026-07-02 10:55     ` Christoph Hellwig
2026-07-01 15:38 ` [PATCH v2 3/3] xfs: fail recovery on a committed log item with no regions Weiming Shi
2026-07-01 22:08   ` Darrick J. Wong
2026-07-02 10:56     ` Christoph Hellwig
2026-07-02 15:32       ` Darrick J. Wong
2026-07-02 16:13         ` Weiming Shi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox