# CVE-2025-40230: mm: prevent poison consumption when splitting THP

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

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **EPSS:** 0.29% (percentile 15, 2026-11-28)
- **Published:** 2025-12-04T15:31:21.369Z
- **Modified:** 2026-10-19T21:10:00.160Z

## Who should check

- Anyone running Linux \>= b1f202060afeb7fcb98473929d26fd3d2093b067, \< 6fc0a7c99e973a50018c8b4be34914a1b5c7b383; \>= b1f202060afeb7fcb98473929d26fd3d2093b067, \< 92acf4b04f255d2f0f6770bb0d0a208d8ffb2b77; \>= b1f202060afeb7fcb98473929d26fd3d2093b067, \< 841a8bfcbad94bb1ba60f59ce34f75259074ae0d
- Anyone running Linux 6.12

## Description

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

mm: prevent poison consumption when splitting THP

When performing memory error injection on a THP (Transparent Huge Page)
mapped to userspace on an x86 server, the kernel panics with the following
trace.  The expected behavior is to terminate the affected process instead
of panicking the kernel, as the x86 Machine Check code can recover from an
in-userspace \#MC.

  mce: \[Hardware Error\]: CPU 0: Machine Check Exception: f Bank 3: bd80000000070134
  mce: \[Hardware Error\]: RIP 10:\<ffffffff8372f8bc\> {memchr\_inv+0x4c/0xf0}
  mce: \[Hardware Error\]: TSC afff7bbff88a ADDR 1d301b000 MISC 80 PPIN 1e741e77539027db
  mce: \[Hardware Error\]: PROCESSOR 0:d06d0 TIME 1758093249 SOCKET 0 APIC 0 microcode 80000320
  mce: \[Hardware Error\]: Run the above through 'mcelog --ascii'
  mce: \[Hardware Error\]: Machine check: Data load in unrecoverable area of kernel
  Kernel panic - not syncing: Fatal local machine check

The root cause of this panic is that handling a memory failure triggered
by an in-userspace \#MC necessitates splitting the THP.  The splitting
process employs a mechanism, implemented in
try\_to\_map\_unused\_to\_zeropage(), which reads the pages in the THP to
identify zero-filled pages.  However, reading the pages in the THP results
in a second in-kernel \#MC, occurring before the initial memory\_failure()
completes, ultimately leading to a kernel panic.  See the kernel panic
call trace on the two \#MCs.

  First Machine Check occurs // \[1\]
    memory\_failure()         // \[2\]
      try\_to\_split\_thp\_page()
        split\_huge\_page()
          split\_huge\_page\_to\_list\_to\_order()
            \_\_folio\_split()  // \[3\]
              remap\_page()
                remove\_migration\_ptes()
                  remove\_migration\_pte()
                    try\_to\_map\_unused\_to\_zeropage()  // \[4\]
                      memchr\_inv()                   // \[5\]
                        Second Machine Check occurs  // \[6\]
                          Kernel panic

\[1\] Triggered by accessing a hardware-poisoned THP in userspace, which is
    typically recoverable by terminating the affected process.

\[2\] Call folio\_set\_has\_hwpoisoned() before try\_to\_split\_thp\_page().

\[3\] Pass the RMP\_USE\_SHARED\_ZEROPAGE remap flag to remap\_page().

\[4\] Try to map the unused THP to zeropage.

\[5\] Re-access pages in the hw-poisoned THP in the kernel.

\[6\] Triggered in-kernel, leading to a panic kernel.

In Step\[2\], memory\_failure() sets the poisoned flag on the page in the THP
by TestSetPageHWPoison() before calling try\_to\_split\_thp\_page().

As suggested by David Hildenbrand, fix this panic by not accessing to the
poisoned page in the THP during zeropage identification, while continuing
to scan unaffected pages in the THP for possible zeropage mapping.  This
prevents a second in-kernel \#MC that would cause kernel panic in Step\[4\].

Thanks to Andrew Zaborowski for his initial work on fixing this issue.

## Affected and fixed versions

- Linux: \>= b1f202060afeb7fcb98473929d26fd3d2093b067, \< 6fc0a7c99e973a50018c8b4be34914a1b5c7b383; \>= b1f202060afeb7fcb98473929d26fd3d2093b067, \< 92acf4b04f255d2f0f6770bb0d0a208d8ffb2b77; \>= b1f202060afeb7fcb98473929d26fd3d2093b067, \< 841a8bfcbad94bb1ba60f59ce34f75259074ae0d (cvelist)
- Linux: 6.12 (cvelist)

## Mitigation

- Upgrade Linux to 841a8bfcbad94bb1ba60f59ce34f75259074ae0d or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2025-40230.md
Affected: Linux >= b1f202060afeb7fcb98473929d26fd3d2093b067, < 6fc0a7c99e973a50018c8b4be34914a1b5c7b383; >= b1f202060afeb7fcb98473929d26fd3d2093b067, < 92acf4b04f255d2f0f6770bb0d0a208d8ffb2b77; >= b1f202060afeb7fcb98473929d26fd3d2093b067, < 841a8bfcbad94bb1ba60f59ce34f75259074ae0d; Linux 6.12
Fixed in: Linux 6fc0a7c99e973a50018c8b4be34914a1b5c7b383, Linux 92acf4b04f255d2f0f6770bb0d0a208d8ffb2b77, Linux 841a8bfcbad94bb1ba60f59ce34f75259074ae0d

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-40230 being exploited?

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

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

It has no CVSS score yet. Unknown.

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

Linux \>= b1f202060afeb7fcb98473929d26fd3d2093b067, \< 6fc0a7c99e973a50018c8b4be34914a1b5c7b383; \>= b1f202060afeb7fcb98473929d26fd3d2093b067, \< 92acf4b04f255d2f0f6770bb0d0a208d8ffb2b77; \>= b1f202060afeb7fcb98473929d26fd3d2093b067, \< 841a8bfcbad94bb1ba60f59ce34f75259074ae0d; Linux 6.12.

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

Yes. Fixed in Linux 6fc0a7c99e973a50018c8b4be34914a1b5c7b383, Linux 92acf4b04f255d2f0f6770bb0d0a208d8ffb2b77, Linux 841a8bfcbad94bb1ba60f59ce34f75259074ae0d. Upgrade Linux to 841a8bfcbad94bb1ba60f59ce34f75259074ae0d or later.

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

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

- other: <https://git.kernel.org/stable/c/6fc0a7c99e973a50018c8b4be34914a1b5c7b383>
- other: <https://git.kernel.org/stable/c/92acf4b04f255d2f0f6770bb0d0a208d8ffb2b77>
- other: <https://git.kernel.org/stable/c/841a8bfcbad94bb1ba60f59ce34f75259074ae0d>

## 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-40230>

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