{"id":"CVE-2026-139798","aliases":[],"cve":{"records":[{"id":"CVE-2026-139798","source":"Linux","state":"PUBLISHED","reasons":[],"replacements":[],"disputed":false,"unsupportedWhenAssigned":false,"reserved":"2026-11-30T13:22:15.953Z","published":"2026-11-30T13:38:05.841Z","modified":"2026-11-30T13:38:05.841Z"}],"publishers":[{"name":"Linux","role":"CNA","organizationId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","modified":"2026-11-30T13:38:05.841Z"}],"references":[{"url":"https://git.kernel.org/stable/c/a336cd46459c1a7608cc805ec04a59890e993baa","tags":[],"source":"Linux"},{"url":"https://git.kernel.org/stable/c/13fc99f46399c9d38d1b54ecf0a3f387ba04d05d","tags":[],"source":"Linux"}],"weaknesses":[],"applicability":[{"source":"Linux","statements":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.19","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.19","versionEndExcluding":"7.4-rc2"}]}]}]}],"prioritization":[]},"title":"mm: do not unintentionally overwrite atomic VMA flags","titleSource":"Linux","descriptionSource":"Linux","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm: do not unintentionally overwrite atomic VMA flags\n\nPatch series \"mm: avoid losing atomic VMA flags\", v1.\n\nSince commit 2ab7f1bbafc9 (\"mm/madvise: allow guard page install/remove\nunder VMA lock\"), VMA_MAYBE_GUARD_BIT can be set atomically under the VMA\nread lock.\n\nHowever, a number of places wrongly assume the flags are stable under the\nread lock, which can cause stale atomic VMA flags to overwrite existing\nvalid ones.\n\nAdditionally, one case in which VMA_SOFTDIRTY_BIT was overwritten is also\naddressed.\n\nThis series addresses each of these, while keeping the logic inline with\nexisting conventions.\n\nEach patch in this series is a hotfix.\n\n\nThis patch (of 4):\n\nmadvise, mlock and mprotect take a copy of a VMA's flags holding only the\nVMA read lock, later writing it back under the write lock (in\nmadvise_update_vma(), mlock_fixup(), mlock_vma_pages_range() and\nmprotect_fixup()).\n\nThis was done on the assumption that VMA flags cannot change with a read\nlock held.\n\nHowever this changed in commit 2ab7f1bbafc9 (\"mm/madvise: allow guard page\ninstall/remove under VMA lock\"), which allowed VM_ATOMIC_SET_ALLOWED\nflags (currently only VMA_MAYBE_GUARD_BIT) to be written concurrently under\na VMA read lock.\n\nThe actual write itself is safe as this is done under the VMA write lock\nat which point no further concurrent writes can occur, however at this\npoint the stale flags mean that these callers can unintentionally overwrite\natomic flags incorrectly.\n\nThe consequences of this are significant - a missing VMA_MAYBE_GUARD_BIT\ncould result in page tables not being copied on fork (the vma_needs_copy()\ncheck can return false) or being overwritten on file-backed THP\ncollapse (the file_backed_vma_is_retractable() can return true).\n\nResolve the issue by always taking care to retain existing atomic flags\nwhen overwriting VMA flags, replacing the inconsistently named\nvma_flags_reset_once() with vma_overwrite_flags() to do so, and always\ninvoking it when flags are overwritten like this.\n\nReads are a problem too - madvise, mlock and mprotect all compare VMA flags\nwithout a VMA write lock held via vma_flags_same_pair().\n\nThis has more serious impact, as concurrent changes to atomic VMA flags can\ncause two sets of VMA flags to be wrongly considered different.\n\nFor mprotect and madvise this causes a useless split, but mlock is impacted\nmore seriously as it can result in mm->locked_vm underflow.\n\nFix this by updating vma_flags_same_pair() to disregard\nVM_ATOMIC_SET_ALLOWED VMAs - VMA equality is the same as VMA mergeability,\nand atomic VMA flags are disregarded when comparing VMA flags for merge -\nso this is justified semantically.\n\nAdditionally, remove the redundant vma_flags_same_mask() and the unused\nvma_flags_same() as part of the change, and replace VM_ATOMIC_SET_ALLOWED\nwith VMA_ATOMIC_SET_ALLOWED, using the new VMA flag API.\n\nFinally, update userland VMA tests to reflect the changes.","score":null,"severity":"unknown","published":"2026-11-30T13:38:05.841Z","modified":"2026-11-30T13:38:05.841Z","withdrawn":false,"knownExploited":false,"affected":[],"products":[{"vendor":"Linux","name":"Linux","platforms":[],"versions":[{"version":"2ab7f1bbafc927c69374d45578011c814c26ae2f","status":"affected","lessThan":"a336cd46459c1a7608cc805ec04a59890e993baa","versionType":"git"},{"version":"2ab7f1bbafc927c69374d45578011c814c26ae2f","status":"affected","lessThan":"13fc99f46399c9d38d1b54ecf0a3f387ba04d05d","versionType":"git"}],"defaultStatus":"unaffected","cpes":[],"source":"Linux","url":"https://www.cve.org/CVERecord?id=CVE-2026-139798"},{"vendor":"Linux","name":"Linux","platforms":[],"versions":[{"version":"6.19","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.19","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc2","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"defaultStatus":"affected","cpes":[],"source":"Linux","url":"https://www.cve.org/CVERecord?id=CVE-2026-139798"}],"remediation":[],"references":["https://git.kernel.org/stable/c/a336cd46459c1a7608cc805ec04a59890e993baa","https://git.kernel.org/stable/c/13fc99f46399c9d38d1b54ecf0a3f387ba04d05d"],"sources":[{"name":"CVE","id":"CVE-2026-139798","modified":"2026-11-30T13:38:05.841Z","url":"https://www.cve.org/CVERecord?id=CVE-2026-139798"}],"assessments":[],"sourceAffected":[],"observedAt":"2026-11-30T14:29:42.148Z","kev":{"status":"not-listed","checkedAt":"2026-11-30T23:05:32.102Z"},"coverage":[{"source":"NVD","status":"available","checkedAt":"2026-11-30T14:30:34.803Z","attemptedAt":"2026-11-30T14:30:34.803Z"},{"source":"GHSA","status":"no-result","checkedAt":"2026-11-30T14:30:33.755Z","attemptedAt":"2026-11-30T14:30:33.755Z"},{"source":"EUVD","status":"no-result","checkedAt":"2026-11-30T14:30:33.274Z","attemptedAt":"2026-11-30T14:30:33.274Z"},{"source":"EPSS","status":"no-result","checkedAt":"2026-11-30T14:30:34.175Z","attemptedAt":"2026-11-30T14:30:34.175Z"}],"evidence":[{"source":"NVD","id":"CVE-2026-139798","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139798","modified":"2026-11-30T14:20:14.127","checkedAt":"2026-11-30T14:30:34.803Z"}],"aiSummary":null}