CVE-2026-139786
published high CVSS 3.1 · 7.0mm/vma: avoid spurious write locks when mm->mm_lock_seq overflows
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Linux | — | Linux5e31275cc997f8ec5d9e8d65fe9840ebed89db19 to < 23f50b2fbf48f18fd1a6f2195a33c354619dedab · 5e31275cc997f8ec5d9e8d65fe9840ebed89db19 to < 068a80b062757b208fa8af13554bd07608848203 · 5e31275cc997f8ec5d9e8d65fe9840ebed89db19 to < 59381aea52a464e882eb85a61728dc147c1b8b50 · 5e31275cc997f8ec5d9e8d65fe9840ebed89db19 to < 1a0b5660087189a322dd3b8f548701b887809d72 · 5e31275cc997f8ec5d9e8d65fe9840ebed89db19 to < 7135a05838e85845e1bbf6caa6596a7e3b791a40 · Other versions: unaffected | Affected | Not stated | Linux |
| Linux | — | Linux6.4 (affected) · 0 to < 6.4 (unaffected · semver) · 6.6.163 through 6.6.* (unaffected · semver) · 6.12.119 through 6.12.* (unaffected · semver) · 6.18.65 through 6.18.* (unaffected · semver) · 7.3.6 through 7.3.* (unaffected · semver) · 7.4-rc1 and later (unaffected · original_commit_for_fix) · Other versions: affected | Version-specific | Not stated | Linux |
Description
In the Linux kernel, the following vulnerability has been resolved: mm/vma: avoid spurious write locks when mm->mm_lock_seq overflows So far the assumption has been that mm->mm_lock_seq overflow is benign, resulting only in readers spuriously falling back to the mmap lock, however it turns out that this was an unsafe assumption. If a VMA can be spuriously considered write locked that means read lock exclusion does not take place, and thus a VMA can end up write-locked with concurrent readers. Since overflow only occurs every 2^31 write lock/unlock cycles, resolve the issue by resetting every VMA's vma->vm_lock_seq each time such an overflow occurs. This is done in vma_end_write_all(), which is called when the mmap write lock is released, i.e. in mmap_write_unlock() and mmap_write_downgrade(). Care must be taken, as resetting the sequence count at overflow means changing the seqcount of VMAs which are already attached and observable. The mm's seqcount is guaranteed to be odd when a write lock is held, and thus any write locked VMA will have an odd seqcount assigned. Therefore resetting to an even value prevents spurious write locks, since these can only occur with the mmap write lock held, at which point the mmap seqcount will be odd. However, vma_start_read() also checks vma->vm_lock_seq == mm->mm_lock_seq, bailing if so (indicating a write lock). This would cause any even reset value chosen to prevent VMA read locks from being taken - avoid this by also checking whether the VMA seqcount is odd before bailing on the read lock. So far, vma->vm_lock_seq has defaulted to UINT_MAX, but this has been unnecessary since commit e5e7fb278e59 ("mm: convert mm_lock_seq to a proper seqcount"), since this is assigned when the VMA is still detached, and cannot be observed. Therefore perform both reset and initialisation of vma->vm_lock_seq by simply setting vma->vm_lock_seq to zero. The reset, performed in __mm_reset_vma_seqcounts(), only needs to WRITE_ONCE() the value. However the read of vma->vm_lock_seq in vma_start_read() needs to have acquire semantics to pair with the smp_wmb() in do_raw_write_seqcount_end() so a reader reading a reset value also observes VMA modifications made under the write lock. Since all VMA write locks were just released and the mmap write lock is still held, there are no concurrent VMA writers. Concurrent VMA readers are unaffected. New VMA readers observe either zero, never a write lock, or the prior seqcount, behaving as before the reset. Since this only occurs every 2^31 write lock/unlock cycles, the time taken to update all VMAs is considered to be acceptable. Also update comments, documentation and VMA userland tests to reflect the change. User facing effects are - dangerous races that could cause memory corruption or NULL pointer derefences (especially on page table traversal) are avoided.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 7.0 / 10
- Severity
- high
- Provider
- Linux · cna
- Vector string
- CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
- Scenarios
- en: AV:L - The wrap is driven by a local process cycling its own mmap write lock (e.g. munmap() of an empty range via __vm_munmap) until mm->mm_lock_seq matches a stale vma->vm_lock_seq. The race is then run from the same process with page faults or madvise() against its own address space. No remote protocol carries any input. AC:H - The attacker produces the wrap on demand: 2^31 empty munmap() cycles took ~10 minutes (268 ns each) and can be counted exactly in their own mm. Both sides of the race are the attacker's threads: a reader holding the VMA lock (fault or a long MADV_DONTNEED) and a writer (mremap/split/mprotect) issued at the counted cycle. Many prepared VMAs give many attempts per wrap. PR:L - munmap, mremap, mprotect, madvise(MADV_DONTNEED) and page faults on your own mappings need no capability, so any unprivileged local user who can run code can reach vma_start_write() and lock_vma_under_rcu(). UI:N - The attacker performs every step (the counter wrap, the reader thread and the writer thread) on their own process's mappings. No other user or administrator action is involved. S:U - The corruption is in kernel memory-management state (page tables and VMA fields) of the same kernel, and gives kernel-level compromise within the same security authority. No hypervisor or IOMMU boundary is crossed. C:H - When __is_vma_write_locked() falsely returns true, vma_start_write() skips __vma_start_write() and existing readers are not drained. mremap's move_page_tables or a split/unmap then frees or moves page tables under a running fault or zap, giving page-table/page use-after-free and stale PTEs to freed physical pages, which allows arbitrary memory reads. I:H - The same page-table use-after-free, or a stale PTE that the fault path installs after mremap/munmap has torn the range down, gives write access to freed and reallocated physical pages. That is a known route to arbitrary kernel memory writes and privilege escalation. A:H - The commit names memory corruption and NULL pointer dereferences during page-table traversal, from walking freed or moved page tables under the unexcluded per-VMA read lock. These oops or corrupt the kernel, and the attacker can retry after every 2^31-cycle wrap.
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| Linux | Linux | 5e31275cc997f8ec5d9e8d65fe9840ebed89db19 to < 23f50b2fbf48f18fd1a6f2195a33c354619dedab (affected · git)5e31275cc997f8ec5d9e8d65fe9840ebed89db19 to < 068a80b062757b208fa8af13554bd07608848203 (affected · git)5e31275cc997f8ec5d9e8d65fe9840ebed89db19 to < 59381aea52a464e882eb85a61728dc147c1b8b50 (affected · git)5e31275cc997f8ec5d9e8d65fe9840ebed89db19 to < 1a0b5660087189a322dd3b8f548701b887809d72 (affected · git)5e31275cc997f8ec5d9e8d65fe9840ebed89db19 to < 7135a05838e85845e1bbf6caa6596a7e3b791a40 (affected · git)Default: unaffected | Linux · cna |
| Linux | Linux | 6.4 (affected)0 to < 6.4 (unaffected · semver)6.6.163 through 6.6.* (unaffected · semver)6.12.119 through 6.12.* (unaffected · semver)6.18.65 through 6.18.* (unaffected · semver)7.3.6 through 7.3.* (unaffected · semver)7.4-rc1 and later (unaffected · original_commit_for_fix)Default: affected | Linux · cna |
Weaknesses
0No weakness assertions.
References
5- https://git.kernel.org/stable/c/068a80b062757b208fa8af13554bd07608848203
- https://git.kernel.org/stable/c/1a0b5660087189a322dd3b8f548701b887809d72
- https://git.kernel.org/stable/c/23f50b2fbf48f18fd1a6f2195a33c354619dedab
- https://git.kernel.org/stable/c/59381aea52a464e882eb85a61728dc147c1b8b50
- https://git.kernel.org/stable/c/7135a05838e85845e1bbf6caa6596a7e3b791a40
Provider assertions
1Linux · cna
mm/vma: avoid spurious write locks when mm->mm_lock_seq overflows
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- 843d9000d23e1315cf9316bddd694e6d629cc97976a5ad908745de54ac76a746
- Ingested
- 01 Dec 2026, 05:47:22 UTC
- Source record
- Official CVE record