In the Linux kernel, the following vulnerability has been resolved:
xfs: mark the inode preallocated for pNFS write layouts past EOF
xfs_fs_map_blocks() marks the inode XFS_DIFLAG_PREALLOC only when it
allocates blocks for a write layout. A write layout past EOF can also
hand out allocated blocks, such as speculative preallocation. blockgc
then frees them under the layout, and another file may get them.
Mark the inode whenever a write mapping ends past EOF.
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L
CVSS Score: 9.4
AV:N - An NFSv4.1 OP_LAYOUTGET with layout type LAYOUT_BLOCK_VOLUME or LAYOUT_SCSI, iomode IOMODE_RW, and loga_offset past EOF is handled by nfsd4_layoutget, nfsd4_block_proc_layoutget, nfsd4_block_map_extent, then xfs_fs_map_blocks, which returns already-allocated post-EOF blocks and leaves XFS_DIFLAG_PREALLOC clear. The client then reads or writes those blocks after xfs_free_eofblocks reassigns them.
AC:L - The client builds the post-EOF extent: an NFS WRITE above the allocsize threshold makes xfs_iomap_prealloc_size reserve a delalloc tail, and filemap_write_and_wait in xfs_fs_map_blocks converts it with xfs_bmapi_convert_one_delalloc. Default xfs_blockgc_worker (blockgc_timer 300s) then calls xfs_free_eofblocks with no break_layout; the client waits for that scan or forces it via the ENOSPC path in xfs_file_buffered_write.
PR:N - IOMODE_RW only adds NFSD_MAY_WRITE in nfsd4_layoutget before fh_verify. On AUTH_SYS, svcauth_unix_accept copies the caller-supplied uid into cr_uid and checks no secret, so a client asserts any uid that can write the file and reaches xfs_fs_map_blocks.
UI:N - The same client sends the WRITE that creates the speculative tail and the LAYOUTGET that maps it; no other user must mount an image or open the file.
S:U - The freed blocks are reused by another inode on the same XFS mount that handed out the layout, so the impact stays inside that host's filesystem authority.
C:H - xfs_free_eofblocks unmaps the extent while the layout still returns its physical address as bex->soff (iomap.addr) with PNFS_BLOCK_READWRITE_DATA or PNFS_BLOCK_INVALID_DATA, so the client can read the bytes of whichever inode is allocated those blocks.
I:H - That READWRITE or INVALID_DATA layout lets the client overwrite the same blocks after another inode owns them, replacing that file's data.
A:L - Only the recycled file extent is lost. xfs_fs_map_blocks and xfs_free_eofblocks complete without an oops, hang, or xfs_force_shutdown.
| Attack Vector |
Network |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
None |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
Low |
AV:N - An NFSv4.1 OP_LAYOUTGET with layout type LAYOUT_BLOCK_VOLUME or LAYOUT_SCSI, iomode IOMODE_RW, and loga_offset past EOF is handled by nfsd4_layoutget, nfsd4_block_proc_layoutget, nfsd4_block_map_extent, then xfs_fs_map_blocks, which returns already-allocated post-EOF blocks and leaves XFS_DIFLAG_PREALLOC clear. The client then reads or writes those blocks after xfs_free_eofblocks reassigns them.
AC:L - The client builds the post-EOF extent: an NFS WRITE above the allocsize threshold makes xfs_iomap_prealloc_size reserve a delalloc tail, and filemap_write_and_wait in xfs_fs_map_blocks converts it with xfs_bmapi_convert_one_delalloc. Default xfs_blockgc_worker (blockgc_timer 300s) then calls xfs_free_eofblocks with no break_layout; the client waits for that scan or forces it via the ENOSPC path in xfs_file_buffered_write.
PR:N - IOMODE_RW only adds NFSD_MAY_WRITE in nfsd4_layoutget before fh_verify. On AUTH_SYS, svcauth_unix_accept copies the caller-supplied uid into cr_uid and checks no secret, so a client asserts any uid that can write the file and reaches xfs_fs_map_blocks.
UI:N - The same client sends the WRITE that creates the speculative tail and the LAYOUTGET that maps it; no other user must mount an image or open the file.
S:U - The freed blocks are reused by another inode on the same XFS mount that handed out the layout, so the impact stays inside that host's filesystem authority.
C:H - xfs_free_eofblocks unmaps the extent while the layout still returns its physical address as bex->soff (iomap.addr) with PNFS_BLOCK_READWRITE_DATA or PNFS_BLOCK_INVALID_DATA, so the client can read the bytes of whichever inode is allocated those blocks.
I:H - That READWRITE or INVALID_DATA layout lets the client overwrite the same blocks after another inode owns them, replacing that file's data.
A:L - Only the recycled file extent is lost. xfs_fs_map_blocks and xfs_free_eofblocks complete without an oops, hang, or xfs_force_shutdown.
CVSS 3.1