# CVE-2022-50014: mm/gup: fix FOLL\_FORCE COW security issue and remove FOLL\_COW

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.21% (percentile 6, 2026-11-26)
- **CWE:** CWE-362
- **Published:** 2025-06-18T11:01:18.590Z
- **Modified:** 2026-08-05T08:57:09.809Z

## Who should check

- Anyone running Linux \>= 9ae0f87d009ca6c4aab2882641ddfc319727e3db, \< 9def52eb10baab3b700858003d462fcf17d62873; \>= 9ae0f87d009ca6c4aab2882641ddfc319727e3db, \< 5535be3099717646781ce1540cf725965d680e7b
- Anyone running Linux 5.16

## Description

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().

## Affected and fixed versions

- Linux: \>= 9ae0f87d009ca6c4aab2882641ddfc319727e3db, \< 9def52eb10baab3b700858003d462fcf17d62873; \>= 9ae0f87d009ca6c4aab2882641ddfc319727e3db, \< 5535be3099717646781ce1540cf725965d680e7b (cvelist)
- Linux: 5.16 (cvelist)

## Mitigation

- Upgrade Linux to 5535be3099717646781ce1540cf725965d680e7b or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2022-50014. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-50014.md
Affected: Linux >= 9ae0f87d009ca6c4aab2882641ddfc319727e3db, < 9def52eb10baab3b700858003d462fcf17d62873; >= 9ae0f87d009ca6c4aab2882641ddfc319727e3db, < 5535be3099717646781ce1540cf725965d680e7b; Linux 5.16
Fixed in: Linux 9def52eb10baab3b700858003d462fcf17d62873, Linux 5535be3099717646781ce1540cf725965d680e7b

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-2022-50014 being exploited?

There is no confirmed exploitation: CVE-2022-50014 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.21% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2022-50014?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2022-50014?

Linux \>= 9ae0f87d009ca6c4aab2882641ddfc319727e3db, \< 9def52eb10baab3b700858003d462fcf17d62873; \>= 9ae0f87d009ca6c4aab2882641ddfc319727e3db, \< 5535be3099717646781ce1540cf725965d680e7b; Linux 5.16.

### Is there a fix for CVE-2022-50014?

Yes. Fixed in Linux 9def52eb10baab3b700858003d462fcf17d62873, Linux 5535be3099717646781ce1540cf725965d680e7b. Upgrade Linux to 5535be3099717646781ce1540cf725965d680e7b or later.

### How do I check if I'm affected by CVE-2022-50014?

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

- patch: <https://git.kernel.org/stable/c/9def52eb10baab3b700858003d462fcf17d62873>
- patch: <https://git.kernel.org/stable/c/5535be3099717646781ce1540cf725965d680e7b>

## 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-2022-50014>

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