{"id":"CVE-2026-90131","state":"PUBLISHED","title":"ntfs: serialize resident iomap reads with mrec_lock","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nntfs: serialize resident iomap reads with mrec_lock\n\nntfs_read_iomap_begin_resident() walks the MFT record through\nntfs_attr_lookup() -> ntfs_attr_find() without taking ni->mrec_lock,\nwhile ntfs_attr_record_resize(), ntfs_make_room_for_attr() and\nntfs_resident_attr_record_add() memmove() the same base_ni->mrec buffer\nunder that lock. map_mft_record() only takes a reference and does not\nserialize, so the reader can observe torn attribute length and offset\nfields while a writer is relocating the records.\n\nKCSAN reports the race between the mmap read fault path and both link()\nand unlink():\n\n  BUG: KCSAN: data-race in ntfs_attr_find / ntfs_attr_record_resize\n\n  write to 0xffff888100af1018 of 4 bytes by task 96 on cpu 1:\n   ntfs_attr_record_resize+0xd2/0x130\n   ntfs_attr_record_rm+0xad/0x530\n   ntfs_delete+0x224/0x640\n   ntfs_unlink+0x14d/0x280\n   vfs_unlink+0x157/0x520\n\n  read to 0xffff888100af1018 of 4 bytes by task 95 on cpu 0:\n   ntfs_attr_find+0x104/0x5b0\n   ntfs_attr_lookup+0x39c/0x10c0\n   ntfs_read_iomap_begin_resident+0xc6/0x230\n   ntfs_read_iomap_begin+0x5d/0xa0\n   iomap_iter+0x2e2/0x6e0\n   iomap_read_folio+0x147/0x2a0\n   ntfs_read_folio+0x108/0x170\n   filemap_read_folio+0x35/0x100\n   filemap_fault+0x993/0x1000\n\n  value changed: 0x00000250 -> 0x000001f0\n\nThe address is mrec + 0x18, i.e. mft_record.bytes_in_use, and the change\nis the 96 bytes of one $FILE_NAME attribute being removed.\n\nKeep base_ni->mrec_lock from the resident read iomap lookup through\niomap_end(). This protects both the attribute walk and the subsequent copy\nfrom iomap->inline_data, which points into the MFT record. The non-resident\npath is left alone: ntfs_lookup() already holds the directory inode's\nmrec_lock when it reads an index folio through read_mapping_folio(), and\ntaking the lock in the shared wrapper deadlocks there with recursive locking\non mrec_lock. The comment above the read_mapping_folio() call in\nfs/ntfs/dir.c notes the same hazard.\n\nThe seek path uses the same lookup helper but does not dereference\niomap->inline_data. Release the lock before returning from that path,\nwhereas the regular read path records base_ni in iomap->private and releases\nthe lock from its iomap_end() callback.\n\nTested with a reproducer that faults in a 16-byte resident file while\nanother thread runs link()/unlink() on it. Before: 40 KCSAN reports in\nabout one second. After: no reports in 180 seconds over 206,090 read\niterations and 423,540 link/unlink cycles. A PROVE_LOCKING build shows no\nlockdep splat with the same reproducer running for 60 seconds.","publishedAt":"2026-09-17T16:06:31.913Z","updatedAt":"2026-10-19T08:58:29.513Z","severity":{"score":7.1,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"b041ca562526b3c4a71b41b80ba5e520eac636ad","status":"affected","lessThan":"0400e0d50eb3be19c98323faa322b652e4ae3f99","versionType":"git"},{"version":"b041ca562526b3c4a71b41b80ba5e520eac636ad","status":"affected","lessThan":"d9e00c457d4ab8ab59c6e4b8554c921260e4e16c","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ntfs/iomap.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"7.1","status":"affected"},{"version":"0","status":"unaffected","lessThan":"7.1","versionType":"semver"},{"version":"7.2.6","status":"unaffected","lessThanOrEqual":"7.2.*","versionType":"semver"},{"version":"7.3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ntfs/iomap.c"]}],"references":["https://git.kernel.org/stable/c/0400e0d50eb3be19c98323faa322b652e4ae3f99","https://git.kernel.org/stable/c/d9e00c457d4ab8ab59c6e4b8554c921260e4e16c"],"weaknesses":[],"ingestedAt":"2026-10-29T20:13:34.582Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/90xxx/CVE-2026-90131.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-90131","state":"PUBLISHED","datePublished":"2026-09-17T16:06:31.913Z","dateUpdated":"2026-10-19T08:58:29.513Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-09-11T19:38:34.788Z"},"containers":{"cna":{"title":"ntfs: serialize resident iomap reads with mrec_lock","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nntfs: serialize resident iomap reads with mrec_lock\n\nntfs_read_iomap_begin_resident() walks the MFT record through\nntfs_attr_lookup() -> ntfs_attr_find() without taking ni->mrec_lock,\nwhile ntfs_attr_record_resize(), ntfs_make_room_for_attr() and\nntfs_resident_attr_record_add() memmove() the same base_ni->mrec buffer\nunder that lock. map_mft_record() only takes a reference and does not\nserialize, so the reader can observe torn attribute length and offset\nfields while a writer is relocating the records.\n\nKCSAN reports the race between the mmap read fault path and both link()\nand unlink():\n\n  BUG: KCSAN: data-race in ntfs_attr_find / ntfs_attr_record_resize\n\n  write to 0xffff888100af1018 of 4 bytes by task 96 on cpu 1:\n   ntfs_attr_record_resize+0xd2/0x130\n   ntfs_attr_record_rm+0xad/0x530\n   ntfs_delete+0x224/0x640\n   ntfs_unlink+0x14d/0x280\n   vfs_unlink+0x157/0x520\n\n  read to 0xffff888100af1018 of 4 bytes by task 95 on cpu 0:\n   ntfs_attr_find+0x104/0x5b0\n   ntfs_attr_lookup+0x39c/0x10c0\n   ntfs_read_iomap_begin_resident+0xc6/0x230\n   ntfs_read_iomap_begin+0x5d/0xa0\n   iomap_iter+0x2e2/0x6e0\n   iomap_read_folio+0x147/0x2a0\n   ntfs_read_folio+0x108/0x170\n   filemap_read_folio+0x35/0x100\n   filemap_fault+0x993/0x1000\n\n  value changed: 0x00000250 -> 0x000001f0\n\nThe address is mrec + 0x18, i.e. mft_record.bytes_in_use, and the change\nis the 96 bytes of one $FILE_NAME attribute being removed.\n\nKeep base_ni->mrec_lock from the resident read iomap lookup through\niomap_end(). This protects both the attribute walk and the subsequent copy\nfrom iomap->inline_data, which points into the MFT record. The non-resident\npath is left alone: ntfs_lookup() already holds the directory inode's\nmrec_lock when it reads an index folio through read_mapping_folio(), and\ntaking the lock in the shared wrapper deadlocks there with recursive locking\non mrec_lock. The comment above the read_mapping_folio() call in\nfs/ntfs/dir.c notes the same hazard.\n\nThe seek path uses the same lookup helper but does not dereference\niomap->inline_data. Release the lock before returning from that path,\nwhereas the regular read path records base_ni in iomap->private and releases\nthe lock from its iomap_end() callback.\n\nTested with a reproducer that faults in a 16-byte resident file while\nanother thread runs link()/unlink() on it. Before: 40 KCSAN reports in\nabout one second. After: no reports in 180 seconds over 206,090 read\niterations and 423,540 link/unlink cycles. A PROVE_LOCKING build shows no\nlockdep splat with the same reproducer running for 60 seconds."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"b041ca562526b3c4a71b41b80ba5e520eac636ad","status":"affected","lessThan":"0400e0d50eb3be19c98323faa322b652e4ae3f99","versionType":"git"},{"version":"b041ca562526b3c4a71b41b80ba5e520eac636ad","status":"affected","lessThan":"d9e00c457d4ab8ab59c6e4b8554c921260e4e16c","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ntfs/iomap.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"7.1","status":"affected"},{"version":"0","status":"unaffected","lessThan":"7.1","versionType":"semver"},{"version":"7.2.6","status":"unaffected","lessThanOrEqual":"7.2.*","versionType":"semver"},{"version":"7.3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ntfs/iomap.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/0400e0d50eb3be19c98323faa322b652e4ae3f99"},{"url":"https://git.kernel.org/stable/c/d9e00c457d4ab8ab59c6e4b8554c921260e4e16c"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H","baseScore":7.1,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The raced bytes are the in-memory MFT record (ni->mrec) copied from disk by map_mft_record_folio, not a protocol payload. One thread hits filemap_fault -> ntfs_read_folio -> ntfs_read_iomap_begin_resident -> ntfs_attr_find; the other is local linkat/unlinkat via vfs_link/vfs_unlink -> ntfs_link/ntfs_unlink -> ntfs_attr_record_resize memmove of that same buffer.\nAC:L - The attacker drives both sides: mmap of a resident file so filemap_fault takes ntfs_read_iomap_begin_resident without i_rwsem, while another thread link()/unlink()s so ntfs_attr_record_rm or ntfs_make_room_for_attr memmoves the mrec under mrec_lock. The commit reproducer got 40 KCSAN hits per second on that pair.\nPR:L - ntfs_file_open has no capability check. On an already-mounted writable NTFS volume, an unprivileged user who can mmap a small resident $DATA file and create/remove hard links in a writable directory reaches both the fault path and vfs_link/vfs_unlink. ntfs_fs_type is FS_REQUIRES_DEV without FS_USERNS_MOUNT, so mounting itself needs CAP_SYS_ADMIN but is not required here.\nUI:N - The attacker mmap-faults their own resident file while their other thread runs link()/unlink() on it, matching the commit's 16-byte-file reproducer. No victim mount or crafted image is required; a normal NTFS volume with a small file is enough.\nS:U - The race is inside fs/ntfs on that inode's kmalloc'd mrec and the faulting file's page-cache folio. It does not cross a KVM, IOMMU, or sandbox boundary.\nC:H - ntfs_read_iomap_begin_resident sets iomap->inline_data to ctx->attr plus resident.value_offset with no mrec-size check. ntfs_attr_find computes space from bytes_in_use (KCSAN: 0x250->0x1f0); unsigned underflow plus a torn a->length lets ntfs_resident_attr_value_get accept a value_offset past the kmalloc mft_record_size buffer, and iomap_read_inline_data folio_fill_tail()s that into a folio the attacker reads.\nI:N - The racy path only reads ni->mrec and copies into the mmapped file's folio via iomap_read_inline_data. ntfs_attr_record_resize's memmove is the legitimate link/unlink writer holding mrec_lock and does not give the attacker an arbitrary kernel write.\nA:H - iomap_read_inline_data copies from a value_offset that can lie tens of kilobytes past the kmalloc'd mrec into unmapped heap, oopsing on the filemap_fault path and taking the kernel down."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-10-19T08:58:29.513Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"7.1","versionEndExcluding":"7.2.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"7.1","versionEndExcluding":"7.3"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}