# CVE-2025-21984: mm: fix kernel BUG when userfaultfd\_move encounters swapcache

> 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.22% (percentile 7, 2026-11-28)
- **CWE:** CWE-362
- **Published:** 2025-04-01T15:47:11.523Z
- **Modified:** 2026-08-05T11:55:50.769Z

## Who should check

- Anyone running Linux \>= adef440691bab824e39c1b17382322d195e1fab0, \< 4e9507246298fd6f1ca7bb42ef01a6e34fb93684; \>= adef440691bab824e39c1b17382322d195e1fab0, \< b1e11bd86c0943bb7624efebdc384340a50ad683; \>= adef440691bab824e39c1b17382322d195e1fab0, \< c50f8e6053b0503375c2975bf47f182445aebb4c
- Anyone running Linux 6.8

## Description

In the Linux kernel, the following vulnerability has been resolved:

mm: fix kernel BUG when userfaultfd\_move encounters swapcache

userfaultfd\_move() checks whether the PTE entry is present or a
swap entry.

- If the PTE entry is present, move\_present\_pte() handles folio
  migration by setting:

  src\_folio-\>index = linear\_page\_index(dst\_vma, dst\_addr);

- If the PTE entry is a swap entry, move\_swap\_pte() simply copies
  the PTE to the new dst\_addr.

This approach is incorrect because, even if the PTE is a swap entry,
it can still reference a folio that remains in the swap cache.

This creates a race window between steps 2 and 4.
 1. add\_to\_swap: The folio is added to the swapcache.
 2. try\_to\_unmap: PTEs are converted to swap entries.
 3. pageout: The folio is written back.
 4. Swapcache is cleared.
If userfaultfd\_move() occurs in the window between steps 2 and 4,
after the swap PTE has been moved to the destination, accessing the
destination triggers do\_swap\_page(), which may locate the folio in
the swapcache. However, since the folio's index has not been updated
to match the destination VMA, do\_swap\_page() will detect a mismatch.

This can result in two critical issues depending on the system
configuration.

If KSM is disabled, both small and large folios can trigger a BUG
during the add\_rmap operation due to:

 page\_pgoff(folio, page) != linear\_page\_index(vma, address)

\[   13.336953\] page: refcount:6 mapcount:1 mapping:00000000f43db19c index:0xffffaf150 pfn:0x4667c
\[   13.337520\] head: order:2 mapcount:1 entire\_mapcount:0 nr\_pages\_mapped:1 pincount:0
\[   13.337716\] memcg:ffff00000405f000
\[   13.337849\] anon flags: 0x3fffc0000020459(locked\|uptodate\|dirty\|owner\_priv\_1\|head\|swapbacked\|node=0\|zone=0\|lastcpupid=0xffff)
\[   13.338630\] raw: 03fffc0000020459 ffff80008507b538 ffff80008507b538 ffff000006260361
\[   13.338831\] raw: 0000000ffffaf150 0000000000004000 0000000600000000 ffff00000405f000
\[   13.339031\] head: 03fffc0000020459 ffff80008507b538 ffff80008507b538 ffff000006260361
\[   13.339204\] head: 0000000ffffaf150 0000000000004000 0000000600000000 ffff00000405f000
\[   13.339375\] head: 03fffc0000000202 fffffdffc0199f01 ffffffff00000000 0000000000000001
\[   13.339546\] head: 0000000000000004 0000000000000000 00000000ffffffff 0000000000000000
\[   13.339736\] page dumped because: VM\_BUG\_ON\_PAGE(page\_pgoff(folio, page) != linear\_page\_index(vma, address))
\[   13.340190\] ------------\[ cut here \]------------
\[   13.340316\] kernel BUG at mm/rmap.c:1380!
\[   13.340683\] Internal error: Oops - BUG: 00000000f2000800 \[\#1\] PREEMPT SMP
\[   13.340969\] Modules linked in:
\[   13.341257\] CPU: 1 UID: 0 PID: 107 Comm: a.out Not tainted 6.14.0-rc3-gcf42737e247a-dirty \#299
\[   13.341470\] Hardware name: linux,dummy-virt (DT)
\[   13.341671\] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
\[   13.341815\] pc : \_\_page\_check\_anon\_rmap+0xa0/0xb0
\[   13.341920\] lr : \_\_page\_check\_anon\_rmap+0xa0/0xb0
\[   13.342018\] sp : ffff80008752bb20
\[   13.342093\] x29: ffff80008752bb20 x28: fffffdffc0199f00 x27: 0000000000000001
\[   13.342404\] x26: 0000000000000000 x25: 0000000000000001 x24: 0000000000000001
\[   13.342575\] x23: 0000ffffaf0d0000 x22: 0000ffffaf0d0000 x21: fffffdffc0199f00
\[   13.342731\] x20: fffffdffc0199f00 x19: ffff000006210700 x18: 00000000ffffffff
\[   13.342881\] x17: 6c203d2120296567 x16: 6170202c6f696c6f x15: 662866666f67705f
\[   13.343033\] x14: 6567617028454741 x13: 2929737365726464 x12: ffff800083728ab0
\[   13.343183\] x11: ffff800082996bf8 x10: 0000000000000fd7 x9 : ffff80008011bc40
\[   13.343351\] x8 : 0000000000017fe8 x7 : 00000000fffff000 x6 : ffff8000829eebf8
\[   13.343498\] x5 : c0000000fffff000 x4 : 0000000000000000 x3 : 0000000000000000
\[   13.343645\] x2 : 0000000000000000 x1 : ffff0000062db980 x0 : 000000000000005f
\[   13.343876\] Call trace:
\[   13.344045\]  \_\_page\_check\_anon\_rmap+0xa0/0xb0 (P)
\[   13.344234\]  folio\_add\_anon\_rmap\_ptes+0x22c/0x320
\[   13.344333\]  do\_swap\_page+0x1060/0x1400
\[   13.344417\]  \_\_handl
---truncated---

## Affected and fixed versions

- Linux: \>= adef440691bab824e39c1b17382322d195e1fab0, \< 4e9507246298fd6f1ca7bb42ef01a6e34fb93684; \>= adef440691bab824e39c1b17382322d195e1fab0, \< b1e11bd86c0943bb7624efebdc384340a50ad683; \>= adef440691bab824e39c1b17382322d195e1fab0, \< c50f8e6053b0503375c2975bf47f182445aebb4c (cvelist)
- Linux: 6.8 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2025-21984.md
Affected: Linux >= adef440691bab824e39c1b17382322d195e1fab0, < 4e9507246298fd6f1ca7bb42ef01a6e34fb93684; >= adef440691bab824e39c1b17382322d195e1fab0, < b1e11bd86c0943bb7624efebdc384340a50ad683; >= adef440691bab824e39c1b17382322d195e1fab0, < c50f8e6053b0503375c2975bf47f182445aebb4c; Linux 6.8
Fixed in: Linux 4e9507246298fd6f1ca7bb42ef01a6e34fb93684

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-2025-21984 being exploited?

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

### How serious is CVE-2025-21984?

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

### Which versions are affected by CVE-2025-21984?

Linux \>= adef440691bab824e39c1b17382322d195e1fab0, \< 4e9507246298fd6f1ca7bb42ef01a6e34fb93684; \>= adef440691bab824e39c1b17382322d195e1fab0, \< b1e11bd86c0943bb7624efebdc384340a50ad683; \>= adef440691bab824e39c1b17382322d195e1fab0, \< c50f8e6053b0503375c2975bf47f182445aebb4c; Linux 6.8.

### Is there a fix for CVE-2025-21984?

Yes. Fixed in Linux 4e9507246298fd6f1ca7bb42ef01a6e34fb93684. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2025-21984?

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/4e9507246298fd6f1ca7bb42ef01a6e34fb93684>
- patch: <https://git.kernel.org/stable/c/b1e11bd86c0943bb7624efebdc384340a50ad683>
- patch: <https://git.kernel.org/stable/c/c50f8e6053b0503375c2975bf47f182445aebb4c>

## 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-2025-21984>

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