CVE-2022-50014: mm/gup: fix FOLL_FORCE COW security issue and remove FOLL_COW
In the Linux kernel, the following vulnerability has been resolved:
mm/gup: fix FOLL_FORCE COW security issue and remove FOLL_COW
Ever since the Dirty COW (CVE-2016-5195) security issue happened, we know
that FOLL_FORCE can be possibly dangerous, especially if there are races
that can be exploited by user space.
Right now, it would be sufficient to have some code that sets a PTE of a
R/O-mapped shared page dirty, in order for it to erroneously become
writable by FOLL_FORCE. The implications of setting a write-protected PTE
dirty might not be immediately obvious to everyone.
And in fact ever since commit 9ae0f87d009c ("mm/shmem: unconditionally set
pte dirty in mfill_atomic_install_pte"), we can use UFFDIO_CONTINUE to map
a shmem page R/O while marking the pte dirty. This can be used by
unprivileged user space to modify tmpfs/shmem file content even if the
user does not have write permissions to the file, and to bypass memfd
write sealing -- Dirty COW restricted to tmpfs/shmem (CVE-2022-2590).
To fix such security issues for good, the insight is that we really only
need that fancy retry logic (FOLL_COW) for COW mappings that are not
writable (!VM_WRITE). And in a COW mapping, we really only broke COW if
we have an exclusive anonymous page mapped. If we have something else
mapped, or the mapped anonymous page might be shared (!PageAnonExclusive),
we have to trigger a write fault to break COW. If we don't find an
exclusive anonymous page when we retry, we have to trigger COW breaking
once again because something intervened.
Let's move away from this mandatory-retry + dirty handling and rely on our
PageAnonExclusive() flag for making a similar decision, to use the same
COW logic as in other kernel parts here as well. In case we stumble over
a PTE in a COW mapping that does not map an exclusive anonymous page, COW
was not properly broken and we have to trigger a fake write-fault to break
COW.
Just like we do in can_change_pte_writable() added via commit 64fe24a3e05e
("mm/mprotect: try avoiding write faults for exclusive anonymous pages
when changing protection") and commit 76aefad628aa ("mm/mprotect: fix
soft-dirty check in can_change_pte_writable()"), take care of softdirty
and uffd-wp manually.
For example, a write() via /proc/self/mem to a uffd-wp-protected range has
to fail instead of silently granting write access and bypassing the
userspace fault handler. Note that FOLL_FORCE is not only used for debug
access, but also triggered by applications without debug intentions, for
example, when pinning pages via RDMA.
This fixes CVE-2022-2590. Note that only x86_64 and aarch64 are
affected, because only those support CONFIG_HAVE_ARCH_USERFAULTFD_MINOR.
Fortunately, FOLL_COW is no longer required to handle FOLL_FORCE. So
let's just get rid of it.
Thanks to Nadav Amit for pointing out that the pte_dirty() check in
FOLL_FORCE code is problematic and might be exploitable.
Note 1: We don't check for the PTE being dirty because it doesn't matter
for making a "was COWed" decision anymore, and whoever modifies the
page has to set the page dirty either way.
Note 2: Kernels before extended uffd-wp support and before
PageAnonExclusive (< 5.19) can simply revert the problematic
commit instead and be safe regarding UFFDIO_CONTINUE. A backport to
v5.19 requires minor adjustments due to lack of
vma_soft_dirty_enabled().
Security readout for executives and security teams
Plain-English summary
This Linux kernel flaw can let local unprivileged software modify tmpfs or shared-memory file content despite lacking write permission, and may bypass memfd write seals. It resembles Dirty COW behavior but is limited to tmpfs/shmem conditions described by the kernel maintainers.
Executive priority
Treat this as a kernel patching priority for shared Linux infrastructure. It is not evidenced as remotely exploitable or actively exploited, but it can undermine local file permission and sealing assumptions on affected systems.
Technical view
The issue is in get_user_pages FOLL_FORCE copy-on-write handling. A read-only shmem page could be mapped with a dirty PTE through UFFDIO_CONTINUE, causing FOLL_FORCE to treat it as writable. The fix removes FOLL_COW and relies on PageAnonExclusive-based COW decisions.
Likely exposure
Exposure is most likely on Linux kernels in the affected 5.16 to 5.19.6/6.0 range on x86_64 or aarch64 where CONFIG_HAVE_ARCH_USERFAULTFD_MINOR is supported. Systems without unprivileged local code execution are less exposed.
Exploitation context
The bundle does not report active exploitation, and KEV is false. Exploitation requires local user-space interaction with affected kernel memory-management paths and tmpfs/shmem behavior, not remote network access based on the provided sources.
Researcher notes
The source explicitly ties the fix to CVE-2022-2590 behavior and says only x86_64 and aarch64 are affected because of CONFIG_HAVE_ARCH_USERFAULTFD_MINOR. Version and backport exposure should be confirmed through distribution kernel advisories.
Mitigation direction
Apply vendor kernel updates containing the referenced stable fixes.
For older backports, follow vendor guidance on reverting the problematic shmem commit.
Prioritize multi-user systems and hosts running untrusted local workloads.
Check Linux distribution advisories for exact fixed package versions.
Validation and detection
Inventory kernel versions and architectures across Linux assets.
Confirm whether affected hosts are x86_64 or aarch64.
Verify installed kernels include the referenced stable commits or vendor backports.
Review whether untrusted users or workloads can run locally.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2022-50014 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
0CVSS vectors
3Timeline events
0ADP providers
3Source links
Vulnerability timeline
Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.
CVE reservedCVE Program
The CVE ID was reserved by the assigning CNA.
CVE publishedCVE Program
The CVE record was published.
Jun 18, 2025, 11:01 UTC (UTC+00:00)
CVE updatedCVE Program
The CVE record metadata indicates this as the latest update time.