HIGH Introduced in 7.1
ntfs PageMkwrite Race
CVE-2026-99241
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
01Description
In the Linux kernel, the following vulnerability has been resolved: ntfs: take invalidate_lock in ntfs_filemap_page_mkwrite() ntfs_filemap_page_mkwrite() calls iomap_page_mkwrite() without holding mapping->invalidate_lock, so a concurrent truncate or fallocate can be in the middle of invalidating pagecache and rewriting the runlist while the write fault maps blocks and dirties the folio. This races with ntfs_attr_fallocate(), which merges clusters into the in-memory runlist, drops the runlist lock, and only afterwards zeroes the newly allocated clusters on disk; and with the punch-hole/insert/collapse paths that free clusters after truncating the cache. Per Documentation/filesystems/locking.rst, ->page_mkwrite() must ensure there are no truncate/invalidate races, "usually mapping->invalidate_lock is suitable for proper serialization". xfs takes its mmaplock (= the invalidate_lock rwsem) shared in exactly this path. Take invalidate_lock shared around iomap_page_mkwrite(). The read-only fault path is already covered because filemap_fault() itself grabs invalidate_lock shared on instantiation/read paths; only page_mkwrite was bypassing it in this driver.
02KernelScan AI Analysis
Risk summary
A local attacker with access to an NTFS mount can trigger a race between memory-mapped write faults and concurrent truncate or fallocate operations, potentially corrupting filesystem metadata or causing a kernel crash. The vulnerability affects any system with an NTFS filesystem mounted and is reachable from unprivileged user namespaces.
Vulnerability analysis
The NTFS driver's write fault handler for memory-mapped files (ntfs_filemap_page_mkwrite) was calling the iomap layer to map blocks and dirty the folio without holding the address space's invalidate_lock. This allowed a concurrent truncate or fallocate operation — which holds that lock exclusively while invalidating pagecache and rewriting the on-disk runlist — to interleave with the fault, leading to filesystem metadata corruption or data loss. The fix adds shared invalidate_lock acquisition around the iomap_page_mkwrite call, matching the serialization used by XFS and required by the kernel's filesystem locking documentation. Any local user who can mmap an NTFS file for writing and race it against a fallocate or truncate on the same file can trigger the bug; no special privileges or hardware are required.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 7.2 | 7.1 | 7.2.14 | 57c0d5281666 |
| mainline | 7.1 | 7.3 | 0fecc393f206 |