diff options
| author | Chris Mason <mason@kernel.org> | 2026-11-12 16:46:15 -0500 |
|---|---|---|
| committer | Carlos Maiolino <cem@kernel.org> | 2026-11-16 11:45:49 +0100 |
| commit | 230565493938cc0284116ff3795eb5343781eb97 (patch) | |
| tree | 7e3f909eb3102caaee61c802b4243a22b76996c7 /rust/kernel/alloc | |
| parent | f01f70e00770c6d21b468f80b488e6407a6947dc (diff) | |
xfs: take the MMAPLOCK in xfs_fileattr_set()
A store through a shared mapping can corrupt a realtime file system on
disk, or shut a file system down, if FS_IOC_FSSETXATTR changes the
realtime flag or an extent size hint of the file during the write fault.
A write fault reads the flag and the hints more than once: to choose
delayed allocation, to size the block reservation, and again in the
allocator. All of these have to see the same values. System calls that
write do the same, but they hold the IOLOCK, which keeps the ioctl out.
A fault only holds the MMAPLOCK, which the ioctl does not take:
write fault FS_IOC_FSSETXATTR
=========== =================
takes the MMAPLOCK
xfs_iomap_write_direct()
reserves blocks for the old hint
takes the ILOCK
raises the hint
drops the ILOCK
takes the ILOCK
xfs_bmapi_write()
allocates for the new hint
/* more than was reserved */
The fix used here is to make the ioctl take the MMAPLOCK of a regular
file as well.
Signed-off-by: Chris Mason <mason@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Diffstat (limited to 'rust/kernel/alloc')
0 files changed, 0 insertions, 0 deletions
