In the Linux kernel, the following vulnerability has been resolved:
xfs: fix the rtrmap and rtrefcount _maxlevels_ondisk functions
The _maxlevels_ondisk functions are used to compute the size of
in-memory btree cursors for each btree type. Unfortunately, LOLLM
noticed that the rtrmap and rtrefcount versions of these functions
forget to account for the inode root, which means that we could access
beyond the end of the cursor given a sufficiently large btree. Fix
this.
CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
CVSS Score: 7.8
AV:L - The overflow is driven by on-disk XFS fields: sb_blocksize/sb_rgextents consumed by xfs_rtrefcountbt_compute_maxlevels() and the /rtgroups/N.refcount inode-root bb_level loaded by xfs_iformat_rtrefcount(). Entry is mount(2)→xfs_init_fs_context()→get_tree_bdev()→xfs_fs_fill_super()→xfs_mountfs()→xfs_log_mount_finish()→xlog_recover_finish()→xfs_reflink_recover_cow(); no NFS/SMB/TCP message carries bb_level.
AC:L - xfs_rtrefcountbt_maxlevels_ondisk() sizes the xfs_rtrefcountbt_cur slab for 6 bc_levels slots. A 1K-block rtreflink image with large sb_rgextents makes xfs_rtrefcountbt_compute_maxlevels() set m_rtrefc_maxlevels=7; xfs_iformat_rtrefcount() accepts bb_level=6, so xfs_rtrefcountbt_init_cursor() sets bc_nlevels=7 and xfs_btree_lookup() stores bc_levels[6].ptr. A dirty log makes xlog_recovery_needed() true so this runs on every mount; no race.
PR:N - Crafting the image needs no host account. xfs_fs_type.fs_flags is FS_REQUIRES_DEV|FS_ALLOW_IDMAP|FS_MGTIME|FS_LBS with no FS_USERNS_MOUNT, so mount_capable() is capable(CAP_SYS_ADMIN) in init_user_ns; that privileged mount of the attacker image is scored as UI:R, not attacker privilege.
UI:R - xfs_rtrefcountbt_init_cursor() runs from xfs_refcount_recover_cow_leftovers() in xfs_reflink_recover_cow() during xlog_recover_finish() after xfs_fs_fill_super() attaches the attacker bdev. Because XFS is not FS_USERNS_MOUNT, a victim, automounter, or administrator must mount that image before the undersized cursor is built.
S:U - The bc_levels[] store in xfs_btree_lookup() corrupts the xfs_rtrefcountbt_cur slab in the host kernel that mounted the volume; this is not a KVM/Xen guest-to-host escape or an IOMMU/DMA bypass.
C:H - xfs_btree_lookup() writes cur->bc_levels[level].ptr (uint16_t) at level=bc_nlevels-1 when the xfs_rtrefcountbt_cur object from xfs_rtrefcountbt_maxlevels_ondisk() has only 6 slots; that slab OOB write can disclose or influence adjacent heap objects.
I:H - The same out-of-bounds store of bc_levels[6].ptr past the 6-slot xfs_rtrefcountbt_cur kmem_cache object is a kernel heap write into whatever follows the cursor, enabling adjacent-object corruption toward an arbitrary write or control-flow hijack.
A:H - xfs_btree_simple_query_range() calls xfs_btree_lookup() on that undersized cursor from xfs_refcount_recover_cow_leftovers() during mount recovery; indexing bc_levels[6] oopses or panics the host.
| Attack Vector |
Local |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
None |
Integrity Impact |
High |
| User Interaction |
Required |
Availability Impact |
High |
AV:L - The overflow is driven by on-disk XFS fields: sb_blocksize/sb_rgextents consumed by xfs_rtrefcountbt_compute_maxlevels() and the /rtgroups/N.refcount inode-root bb_level loaded by xfs_iformat_rtrefcount(). Entry is mount(2)→xfs_init_fs_context()→get_tree_bdev()→xfs_fs_fill_super()→xfs_mountfs()→xfs_log_mount_finish()→xlog_recover_finish()→xfs_reflink_recover_cow(); no NFS/SMB/TCP message carries bb_level.
AC:L - xfs_rtrefcountbt_maxlevels_ondisk() sizes the xfs_rtrefcountbt_cur slab for 6 bc_levels slots. A 1K-block rtreflink image with large sb_rgextents makes xfs_rtrefcountbt_compute_maxlevels() set m_rtrefc_maxlevels=7; xfs_iformat_rtrefcount() accepts bb_level=6, so xfs_rtrefcountbt_init_cursor() sets bc_nlevels=7 and xfs_btree_lookup() stores bc_levels[6].ptr. A dirty log makes xlog_recovery_needed() true so this runs on every mount; no race.
PR:N - Crafting the image needs no host account. xfs_fs_type.fs_flags is FS_REQUIRES_DEV|FS_ALLOW_IDMAP|FS_MGTIME|FS_LBS with no FS_USERNS_MOUNT, so mount_capable() is capable(CAP_SYS_ADMIN) in init_user_ns; that privileged mount of the attacker image is scored as UI:R, not attacker privilege.
UI:R - xfs_rtrefcountbt_init_cursor() runs from xfs_refcount_recover_cow_leftovers() in xfs_reflink_recover_cow() during xlog_recover_finish() after xfs_fs_fill_super() attaches the attacker bdev. Because XFS is not FS_USERNS_MOUNT, a victim, automounter, or administrator must mount that image before the undersized cursor is built.
S:U - The bc_levels[] store in xfs_btree_lookup() corrupts the xfs_rtrefcountbt_cur slab in the host kernel that mounted the volume; this is not a KVM/Xen guest-to-host escape or an IOMMU/DMA bypass.
C:H - xfs_btree_lookup() writes cur->bc_levels[level].ptr (uint16_t) at level=bc_nlevels-1 when the xfs_rtrefcountbt_cur object from xfs_rtrefcountbt_maxlevels_ondisk() has only 6 slots; that slab OOB write can disclose or influence adjacent heap objects.
I:H - The same out-of-bounds store of bc_levels[6].ptr past the 6-slot xfs_rtrefcountbt_cur kmem_cache object is a kernel heap write into whatever follows the cursor, enabling adjacent-object corruption toward an arbitrary write or control-flow hijack.
A:H - xfs_btree_simple_query_range() calls xfs_btree_lookup() on that undersized cursor from xfs_refcount_recover_cow_leftovers() during mount recovery; indexing bc_levels[6] oopses or panics the host.
CVSS 3.1