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

Published Dec 4, 2025
·
Updated

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> {memchrinv+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 trytomapunusedtozeropage(), 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 memoryfailure() completes, ultimately leading to a kernel panic. See the kernel panic call trace on the two #MCs.

First Machine Check occurs // [1] memoryfailure() // [2] trytosplitthppage() splithugepage() splithugepagetolisttoorder() foliosplit() // [3] remappage() removemigrationptes() removemigrationpte() trytomapunusedtozeropage() // [4] memchrinv() // [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 foliosethashwpoisoned() before trytosplitthppage().

[3] Pass the RMPUSESHAREDZEROPAGE remap flag to remappage().

[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], memoryfailure() sets the poisoned flag on the page in the THP by TestSetPageHWPoison() before calling trytosplitthppage().

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 Software

1 affected component
Linux Linux kernel

Event History

Dec 4, 2025
CVE Published
via MITRE·03:31 PM
Data Sourced
via MITRE·03:31 PM
Description
Data Sourced
via NVD·04:16 PM
Description

Frequently Asked Questions

1

What is the severity of CVE-2025-40230?

CVE-2025-40230 has a high severity due to the potential for kernel panics which can lead to system crashes.

2

How do I fix CVE-2025-40230?

To fix CVE-2025-40230, update your Linux kernel to the latest stable version that includes the security patch.

3

What systems are affected by CVE-2025-40230?

CVE-2025-40230 affects the Linux kernel on x86 servers utilizing Transparent Huge Pages.

4

What is the impact of CVE-2025-40230?

The impact of CVE-2025-40230 is that it may cause kernel panics during memory error injections leading to system instability.

5

When was CVE-2025-40230 disclosed?

CVE-2025-40230 was disclosed as part of a series of updates and patches in the Linux kernel development.

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