CVE-2026-139786
mm/vma: avoid spurious write locks when mm->mm_lock_seq overflows
Check your servers for CVE-2026-139786
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2026-139786 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
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.
Severity (CVSS)
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- local: the attacker needs local access, or a user has to open a prepared file
- Attack complexity
- high: an attack depends on conditions outside the control of the attacker, such as a race
- Privileges required
- low: the attacker needs an ordinary user account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.24%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 15.8% of all scored CVEs. Scores of 1 Dec 2026.
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, before 23f50b2fbf48f18fd1a6f2195a33c354619dedab affected from 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, before 068a80b062757b208fa8af13554bd07608848203 affected from 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, before 59381aea52a464e882eb85a61728dc147c1b8b50 affected from 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, before 1a0b5660087189a322dd3b8f548701b887809d72 affected from 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, before 7135a05838e85845e1bbf6caa6596a7e3b791a40
Other versions: unaffected
|
| Linux |
affected 6.4 unaffected before 6.4 unaffected from 6.6.163 up to and including 6.6.* unaffected from 6.12.119 up to and including 6.12.* unaffected from 6.18.65 up to and including 6.18.* unaffected from 7.3.6 up to and including 7.3.* unaffected 7.4-rc1 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2026-139786 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2026-139786
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2026-139786
trivy image --scanners vuln IMAGE | grep CVE-2026-139786
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/23f50b2fbf48f18fd1a6f2195a33c354619dedab git.kernel.org
- https://git.kernel.org/stable/c/068a80b062757b208fa8af13554bd07608848203 git.kernel.org
- https://git.kernel.org/stable/c/59381aea52a464e882eb85a61728dc147c1b8b50 git.kernel.org
- https://git.kernel.org/stable/c/1a0b5660087189a322dd3b8f548701b887809d72 git.kernel.org
- https://git.kernel.org/stable/c/7135a05838e85845e1bbf6caa6596a7e3b791a40 git.kernel.org
Source: the record CVE-2026-139786 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse