# CVE-2026-139786: mm/vma: avoid spurious write locks when mm-\>mm\_lock\_seq overflows

- **Severity:** HIGH 7.0
- **CVSS:** 7.0 (v3.1, CNA) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **Published:** 2026-11-30T13:37:59.413Z
- **Modified:** 2026-12-01T06:17:49.453Z

## Who should check

- Anyone running Linux \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 23f50b2fbf48f18fd1a6f2195a33c354619dedab; \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 068a80b062757b208fa8af13554bd07608848203; \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 59381aea52a464e882eb85a61728dc147c1b8b50; \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 1a0b5660087189a322dd3b8f548701b887809d72; \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 7135a05838e85845e1bbf6caa6596a7e3b791a40
- Anyone running Linux 6.4

## 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.

## Affected and fixed versions

- Linux: \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 23f50b2fbf48f18fd1a6f2195a33c354619dedab; \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 068a80b062757b208fa8af13554bd07608848203; \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 59381aea52a464e882eb85a61728dc147c1b8b50; \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 1a0b5660087189a322dd3b8f548701b887809d72; \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 7135a05838e85845e1bbf6caa6596a7e3b791a40 (cvelist)
- Linux: 6.4 (cvelist)

## Technologies

Linux kernel

## Mitigation

- Upgrade Linux to 7135a05838e85845e1bbf6caa6596a7e3b791a40 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-139786. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-139786.md
Affected: Linux >= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, < 23f50b2fbf48f18fd1a6f2195a33c354619dedab; >= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, < 068a80b062757b208fa8af13554bd07608848203; >= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, < 59381aea52a464e882eb85a61728dc147c1b8b50; >= 5e31275cc997f8ec5d9e8d6…
Fixed in: Linux 23f50b2fbf48f18fd1a6f2195a33c354619dedab, Linux 068a80b062757b208fa8af13554bd07608848203, Linux 59381aea52a464e882eb85a61728dc147c1b8b50, Linux 1a0b5660087189a322dd3b8f548701b887809d72, Linux 7135a05838e85845e1bbf6caa6596a7e3b791a40

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-139786 being exploited?

There is no confirmed exploitation: CVE-2026-139786 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known.

### How serious is CVE-2026-139786?

High: CVSS 7.0 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2026-139786?

Linux \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 23f50b2fbf48f18fd1a6f2195a33c354619dedab; \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 068a80b062757b208fa8af13554bd07608848203; \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 59381aea52a464e882eb85a61728dc147c1b8b50; \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 1a0b5660087189a322dd3b8f548701b887809d72; \>= 5e31275cc997f8ec5d9e8d65fe9840ebed89db19, \< 7135a05838e85845e1bbf6caa6596a7e3b791a40; Linux 6.4.

### Is there a fix for CVE-2026-139786?

Yes. Fixed in Linux 23f50b2fbf48f18fd1a6f2195a33c354619dedab, Linux 068a80b062757b208fa8af13554bd07608848203, Linux 59381aea52a464e882eb85a61728dc147c1b8b50, Linux 1a0b5660087189a322dd3b8f548701b887809d72, Linux 7135a05838e85845e1bbf6caa6596a7e3b791a40. Upgrade Linux to 7135a05838e85845e1bbf6caa6596a7e3b791a40 or later.

### How do I check if I'm affected by CVE-2026-139786?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- other: <https://git.kernel.org/stable/c/23f50b2fbf48f18fd1a6f2195a33c354619dedab>
- other: <https://git.kernel.org/stable/c/068a80b062757b208fa8af13554bd07608848203>
- other: <https://git.kernel.org/stable/c/59381aea52a464e882eb85a61728dc147c1b8b50>
- other: <https://git.kernel.org/stable/c/1a0b5660087189a322dd3b8f548701b887809d72>
- other: <https://git.kernel.org/stable/c/7135a05838e85845e1bbf6caa6596a7e3b791a40>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-139786>

HTML: <https://flawdb.com/CVE-2026-139786> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-139786>
