Skip to contentSkip to conversation

CVE-2026-99395: xfs: bound inode fork length against the fork size during log recovery

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Nov 19

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

xfs: bound inode fork length against the fork size during log recovery

xlog_recover_inode_commit_pass2() copies an inode log item's data/attr fork region into the inode buffer using the on-log region length without bounding it against the fork capacity, e.g.:

	len = item->ri_buf[2].iov_len;
	memcpy(XFS_DFORK_DPTR(dip), src, len);

The only guard is an ASSERT, which is a no-op on production kernels (CONFIG_XFS_DEBUG off), and xfs_dinode_verify() runs only after the copy. A crafted image with a dirty log can therefore drive a heap out-of-bounds write at mount time. The XFS_ILOG_DBROOT sibling already passes XFS_DFORK_DSIZE as a bound; the DDATA/DEXT and ADATA/AEXT memcpy paths did not.

Bound each logged fork region against the destination fork size before copying it, and reject the log item with -EFSCORRUPTED when it does not fit. Because the recovered inode is only verified after the fork data has been copied in, the checks are done up front, before any memcpy into the on-disk inode.

The Linux kernel CVE team has assigned CVE-2026-99395 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.8 with commit 658fa68b6f34f73c7e4023489accd34c1db91cb1 and fixed in 6.12.117 with commit af559d87fdd921b90c86125f78d8b97d754432dd
	Issue introduced in 5.8 with commit 658fa68b6f34f73c7e4023489accd34c1db91cb1 and fixed in 6.18.61 with commit f2cc5001ffcc1d8e5e16607ce4b6920ea30c2cfe
	Issue introduced in 5.8 with commit 658fa68b6f34f73c7e4023489accd34c1db91cb1 and fixed in 7.3.2 with commit e2768e65a5f2f942c831e3df3b06ad7332d423e6
	Issue introduced in 5.8 with commit 658fa68b6f34f73c7e4023489accd34c1db91cb1 and fixed in 7.4-rc1 with commit 9232301894a06e664d8de2da97175cf98419bd16

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-99395

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
fs/xfs/xfs_inode_item_recover.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/af559d87fdd921b90c86125f78d8b97d754432dd
	https://git.kernel.org/stable/c/f2cc5001ffcc1d8e5e16607ce4b6920ea30c2cfe
	https://git.kernel.org/stable/c/e2768e65a5f2f942c831e3df3b06ad7332d423e6
	https://git.kernel.org/stable/c/9232301894a06e664d8de2da97175cf98419bd16