CVE-2026-139798: mm: do not unintentionally overwrite atomic VMA flags

Published Nov 30, 2026
·
Updated

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"), VMAMAYBEGUARDBIT 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 VMASOFTDIRTYBIT 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 madviseupdatevma(), mlockfixup(), mlockvmapagesrange() and mprotectfixup()).

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 VMATOMICSETALLOWED flags (currently only VMAMAYBEGUARDBIT) 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 VMAMAYBEGUARDBIT could result in page tables not being copied on fork (the vmaneedscopy() check can return false) or being overwritten on file-backed THP collapse (the filebackedvmaisretractable() can return true).

Resolve the issue by always taking care to retain existing atomic flags when overwriting VMA flags, replacing the inconsistently named vmaflagsresetonce() with vmaoverwriteflags() 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 vmaflagssamepair().

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->lockedvm underflow.

Fix this by updating vmaflagssamepair() to disregard VMATOMICSETALLOWED 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 vmaflagssamemask() and the unused vmaflagssame() as part of the change, and replace VMATOMICSETALLOWED with VMAATOMICSETALLOWED, using the new VMA flag API.

Finally, update userland VMA tests to reflect the changes.

Affected Software

1 affected component
Linux Linux kernel

Event History

Nov 30, 2026
CVE Published
via MITRE·01:38 PM
Data Sourced
via MITRE·01:38 PM
Description

Frequently Asked Questions

1

What runtime activity is needed for this issue to occur?

The issue depends on concurrent VMA flag changes: guard-page state can be changed atomically while another path has copied VMA flags under a read lock and later writes those copied flags back under a write lock. The affected writeback paths named in the fix are madvise_update_vma(), mlock_fixup(), mlock_vma_pages_range(), and mprotect_fixup().

2

Which systems are potentially affected?

Systems whose kernel includes commit 2ab7f1bbafc9, which allowed guard-page installation or removal under a VMA lock, may be affected if they also contain the unfixed flag-handling paths. No affected kernel version range is provided.

3

Is a mitigation available if the fix cannot be deployed immediately?

The provided information identifies the patch series as a set of hotfixes but does not provide a configuration change or operational workaround. Reducing use of the affected madvise, mlock, and mprotect paths alongside concurrent guard-page changes may reduce exposure, but this is not stated as a supported mitigation.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203