PT-2026-163839

CVE-2026-139798

·

Published

2026-11-30

·

Updated

2026-11-30

Description by

Score
N/A
Not available

No severity ratings or metrics are available. When they are, we'll update the corresponding info on the page.

In the Linux kernel, the following vulnerability has been resolved:
mm: do not unintentionally overwrite atomic VMA flags
Patch series "mm: avoid losing atomic VMA flags", v1.
Since commit 2ab7f1bbafc9 ("mm/madvise: allow guard page install/remove under VMA lock"), VMA MAYBE GUARD BIT can be set atomically under the VMA read lock.
However, a number of places wrongly assume the flags are stable under the read lock, which can cause stale atomic VMA flags to overwrite existing valid ones.
Additionally, one case in which VMA SOFTDIRTY BIT was overwritten is also addressed.
This series addresses each of these, while keeping the logic inline with existing conventions.
Each patch in this series is a hotfix.
This patch (of 4):
madvise, mlock and mprotect take a copy of a VMA's flags holding only the VMA read lock, later writing it back under the write lock (in madvise update vma(), mlock fixup(), mlock vma pages range() and mprotect fixup()).
This was done on the assumption that VMA flags cannot change with a read lock held.
However this changed in commit 2ab7f1bbafc9 ("mm/madvise: allow guard page install/remove under VMA lock"), which allowed VM ATOMIC SET ALLOWED flags (currently only VMA MAYBE GUARD BIT) to be written concurrently under a VMA read lock.
The actual write itself is safe as this is done under the VMA write lock at which point no further concurrent writes can occur, however at this point the stale flags mean that these callers can unintentionally overwrite atomic flags incorrectly.
The consequences of this are significant - a missing VMA MAYBE GUARD BIT could result in page tables not being copied on fork (the vma needs copy() check can return false) or being overwritten on file-backed THP collapse (the file backed vma is retractable() can return true).
Resolve the issue by always taking care to retain existing atomic flags when overwriting VMA flags, replacing the inconsistently named vma flags reset once() with vma overwrite flags() to do so, and always invoking it when flags are overwritten like this.
Reads are a problem too - madvise, mlock and mprotect all compare VMA flags without a VMA write lock held via vma flags same pair().
This has more serious impact, as concurrent changes to atomic VMA flags can cause two sets of VMA flags to be wrongly considered different.
For mprotect and madvise this causes a useless split, but mlock is impacted more seriously as it can result in mm->locked vm underflow.
Fix this by updating vma flags same pair() to disregard VM ATOMIC SET ALLOWED VMAs - VMA equality is the same as VMA mergeability, and atomic VMA flags are disregarded when comparing VMA flags for merge - so this is justified semantically.
Additionally, remove the redundant vma flags same mask() and the unused vma flags same() as part of the change, and replace VM ATOMIC SET ALLOWED with VMA ATOMIC SET ALLOWED, using the new VMA flag API.
Finally, update userland VMA tests to reflect the changes.
Vendors
Affected products
Related identifiers
Found an issue in the description? Have something to add? Feel free to write us 👾