# CVE-2026-139785: mm/vma: avoid losing atomic VMA flags when setting sticky VMA flags

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **Published:** 2026-11-30T13:37:58.850Z
- **Modified:** 2026-11-30T14:20:11.927Z

> **AI summary (AI-generated, claude-haiku-5-5):** A race in the Linux kernel memory management code can cause VMA sticky flags to be lost during merges, letting fork drop guard region markers and THP collapse discard them.

## Who should check

- Anyone running Linux \>= b836839c1fd94f9fc7ccdce153844fa26116ccc0, \< 671d6e9b404f06c864e08e78123a4d4f84837ac0; \>= 49e14dabed7a294427588d4b315f57fbfcab9990, \< 54b29a37539f6f6649a135ba55565360dd0ea569; \>= 49e14dabed7a294427588d4b315f57fbfcab9990, \< c386d799f423685952138cab8d89f0331825bdee; \>= 6.18.37, \< 6.18.65
- Anyone running Linux 6.19

## Description

In the Linux kernel, the following vulnerability has been resolved:

mm/vma: avoid losing atomic VMA flags when setting sticky VMA flags

vma\_merge\_existing\_range() merges an existing VMA (middle) when its
attributes have changed to match those of one or both adjacent VMAs.

Sticky flags are propagated if they are set in any of the merged VMAs. They
are initialised from vmg-\>vma\_flags, which is assumed to contain middle's
sticky flags when the function is invoked.

However, the VMA write lock is not held for middle when they are first
populated, so concurrent updates to atomic VMA flags may occur, which will
be lost upon merge.

This can result in fork failing to propagate guard region markers and (if
file-backed) THP collapse discarding them.

Resolve this by propagating the sticky flags after middle is locked.

Make life easier by factoring this into propagate\_sticky\_flags(), which
treats vmg-\>vma\_flags as its base (in case any sticky flags are set there),
updating it as sticky flags are accumulated from merged VMAs.

Also update vma\_expand() to use propagate\_sticky\_flags() so all merge paths
utilise it.

propagate\_sticky\_flags() also asserts that the VMA write lock is held for
the VMA whose sticky flags are being read, with a comment explaining why.

Another means by which atomic VMA flags can fail to be observed is when the
merge is finalised in commit\_merge().

rmap locks are dropped in vma\_complete() before the sticky flags are
written, meaning an rmap walker can observe the VMA without sticky flags
set, which can also result in retract\_page\_tables() discarding guard
markers.

Resolve this by assigning the sticky flags before dropping rmap locks,
factored into commit\_sticky\_flags() with a write assert on the VMA being
written to.

Also remove the vma\_set\_flags\_mask() invocation at the end of
vma\_merge\_existing\_range() as this was introduced by commit
64212ba02e66 ("mm: implement sticky VMA flags") to propagate sticky flags,
which is now redundant with the introduction of commit\_sticky\_flags().

The vma\_set\_flags\_mask() invocation at the end of vma\_expand() setting
sticky flags only is also removed for the same reason.

Also update vma\_merge\_existing\_range()'s comment to reflect the fact that
vmg-\>vma\_flags gets updated.

Finally, update the userland VMA tests to reflect a previously missed
const-ification in vma\_assert\_write\_locked() which would otherwise cause a
warning when building them.

## Affected and fixed versions

- Linux: \>= b836839c1fd94f9fc7ccdce153844fa26116ccc0, \< 671d6e9b404f06c864e08e78123a4d4f84837ac0; \>= 49e14dabed7a294427588d4b315f57fbfcab9990, \< 54b29a37539f6f6649a135ba55565360dd0ea569; \>= 49e14dabed7a294427588d4b315f57fbfcab9990, \< c386d799f423685952138cab8d89f0331825bdee; \>= 6.18.37, \< 6.18.65 (cvelist)
- Linux: 6.19 (cvelist)

## Technologies

Linux kernel

## Mitigation

- Upgrade Linux to 6.18.65 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-139785. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-139785.md
Affected: Linux >= b836839c1fd94f9fc7ccdce153844fa26116ccc0, < 671d6e9b404f06c864e08e78123a4d4f84837ac0; >= 49e14dabed7a294427588d4b315f57fbfcab9990, < 54b29a37539f6f6649a135ba55565360dd0ea569; >= 49e14dabed7a294427588d4b315f57fbfcab9990, < c386d799f423685952138cab8d89f0331825bdee; >= 6.18.37, < 6.18.65; Lin…
Fixed in: Linux 671d6e9b404f06c864e08e78123a4d4f84837ac0, Linux 54b29a37539f6f6649a135ba55565360dd0ea569, Linux 6.18.65

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-139785 being exploited?

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

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

It has no CVSS score yet. Unknown.

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

Linux \>= b836839c1fd94f9fc7ccdce153844fa26116ccc0, \< 671d6e9b404f06c864e08e78123a4d4f84837ac0; \>= 49e14dabed7a294427588d4b315f57fbfcab9990, \< 54b29a37539f6f6649a135ba55565360dd0ea569; \>= 49e14dabed7a294427588d4b315f57fbfcab9990, \< c386d799f423685952138cab8d89f0331825bdee; \>= 6.18.37, \< 6.18.65; Linux 6.19.

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

Yes. Fixed in Linux 671d6e9b404f06c864e08e78123a4d4f84837ac0, Linux 54b29a37539f6f6649a135ba55565360dd0ea569, Linux 6.18.65. Upgrade Linux to 6.18.65 or later.

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

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/671d6e9b404f06c864e08e78123a4d4f84837ac0>
- other: <https://git.kernel.org/stable/c/54b29a37539f6f6649a135ba55565360dd0ea569>
- other: <https://git.kernel.org/stable/c/c386d799f423685952138cab8d89f0331825bdee>

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

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