CVE-2025-22090: x86/mm/pat: Fix VM_PAT handling when fork() fails in copy_page_range()

Published Apr 16, 2025
·
Updated

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

x86/mm/pat: Fix VMPAT handling when fork() fails in copypagerange()

If trackpfncopy() fails, we already added the dst VMA to the maple tree. As fork() fails, we'll cleanup the maple tree, and stumble over the dst VMA for which we neither performed any reservation nor copied any page tables.

Consequently untrackpfn() will see VMPAT and try obtaining the PAT information from the page table -- which fails because the page table was not copied.

The easiest fix would be to simply clear the VMPAT flag of the dst VMA if trackpfncopy() fails. However, the whole thing is about "simply" clearing the VMPAT flag is shaky as well: if we passed trackpfncopy() and performed a reservation, but copying the page tables fails, we'll simply clear the VMPAT flag, not properly undoing the reservation ... which is also wrong.

So let's fix it properly: set the VMPAT flag only if the reservation succeeded (leaving it clear initially), and undo the reservation if anything goes wrong while copying the page tables: clearing the VMPAT flag after undoing the reservation.

Note that any copied page table entries will get zapped when the VMA will get removed later, after copypagerange() succeeded; as VMPAT is not set then, we won't try cleaning VMPAT up once more and untrackpfn() will be happy. Note that leaving these page tables in place without a reservation is not a problem, as we are aborting fork(); this process will never run.

A reproducer can trigger this usually at the first try:

https://gitlab.com/davidhildenbrand/scratchspace/-/raw/main/reproducers/patfork.c

WARNING: CPU: 26 PID: 11650 at arch/x86/mm/pat/memtype.c:983 getpatinfo+0xf6/0x110 Modules linked in: ... CPU: 26 UID: 0 PID: 11650 Comm: repro3 Not tainted 6.12.0-rc5+ #92 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-2.fc40 04/01/2014 RIP: 0010:getpatinfo+0xf6/0x110 ... Call Trace: <TASK> ... untrackpfn+0x52/0x110 unmapsinglevma+0xa6/0xe0 unmapvmas+0x105/0x1f0 exitmmap+0xf6/0x460 mmput+0x4b/0x120 copyprocess+0x1bf6/0x2aa0 kernelclone+0xab/0x440 dosysclone+0x66/0x90 dosyscall64+0x95/0x180

Likely this case was missed in:

d155df53f310 ("x86/mm/pat: clear VMPAT if copyp4drange failed")

... and instead of undoing the reservation we simply cleared the VMPAT flag.

Keep the documentation of these functions in include/linux/pgtable.h, one place is more than sufficient -- we should clean that up for the other functions like trackpfnremap/untrackpfn separately.

Affected Software

6 affected components
Linux Linux kernel
Linux Linux kernel>=2.6.29<6.6.87
Linux Linux kernel>=6.7<6.12.23
Linux Linux kernel>=6.13<6.13.11
Linux Linux kernel>=6.14<6.14.2
Microsoft cbl2 kernel 5.15.186.1-1

Event History

Apr 16, 2025
CVE Published
via MITRE·02:12 PM
Data Sourced
via MITRE·02:12 PM
DescriptionSeverity
Data Sourced
via NVD·03:16 PM
RemedyDescriptionSeverityAffected Software
Nov 2, 2025
Data Sourced
via Microsoft·01:02 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·01:02 AM
Affected Software
Updated
via Microsoft·01:02 AM
DescriptionSeverity

Frequently Asked Questions

1

What is the severity of CVE-2025-22090?

CVE-2025-22090 is classified as a medium-severity vulnerability due to its potential impact on kernel memory management.

2

How do I fix CVE-2025-22090?

To remediate CVE-2025-22090, update your Linux kernel to the latest stable version that includes the fix.

3

What systems are affected by CVE-2025-22090?

CVE-2025-22090 affects various versions of the Linux kernel on x86 architectures.

4

What are the risks associated with CVE-2025-22090?

Exploitation of CVE-2025-22090 could lead to kernel memory corruption and unstable system behavior.

5

When was CVE-2025-22090 disclosed?

CVE-2025-22090 was disclosed in early 2025 as part of regular kernel security updates.

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