Skip to main content
Vulnerability Database/CVE-2026-97945

CVE-2026-97945: Linux Kernel Data Loss Vulnerability

CVE-2026-97945 is an information disclosure flaw in the Linux kernel that causes user-space data loss with MADV_FREE and THP. This article covers the technical details, affected versions, impact, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-97945 Overview

CVE-2026-97945 is a Linux kernel vulnerability in the x86 memory management subsystem that causes silent user-space data loss. The flaw affects workloads combining Transparent Huge Pages (THP), MADV_FREE, and reclaim pressure. Users of the Polars data analytics library lost production data due to this bug.

The root cause is in pmd_modify(), which strips the hardware dirty bit from Page Middle Directory (PMD) entries. Any mprotect() call or NUMA hinting fault on a writable, dirty PMD-mapped THP loses dirty state. Reclaim then treats rewritten memory as discardable, freeing it and returning zero pages on subsequent reads.

Critical Impact

Silent user-space data corruption on PMD-mapped THP memory when combined with MADV_FREE and memory reclaim pressure. Both anonymous and file-backed THP are affected.

Affected Products

  • Linux kernel on x86/x86_64 architectures with Transparent Huge Pages enabled
  • Workloads using MADV_FREE with PMD-mapped THP (for example, the Polars analytics library)
  • Systems subject to memory reclaim pressure, including memcg-constrained containers

Discovery Timeline

  • 2026-09-25 - CVE-2026-97945 published to NVD
  • 2026-09-25 - Last updated in NVD database

Technical Details for CVE-2026-97945

Vulnerability Analysis

The vulnerability lives in the x86 memory management code, specifically in pmd_modify(). This function is called when a Page Middle Directory entry is modified by operations such as mprotect() or NUMA balancing hinting faults. pmd_modify() masks the old PMD value with (_HPAGE_CHG_MASK & ~_PAGE_DIRTY), which silently discards the hardware dirty bit before any save operation can preserve it.

The subsequent pmd_mksaveddirty() call is designed to transfer _PAGE_DIRTY into _PAGE_SAVED_DIRTY when the entry is write-protected. Because the dirty bit was already stripped from the value, no state remains to transfer. The sibling helpers pte_modify() and pud_modify() both preserve _PAGE_DIRTY in their masks, making pmd_modify() the inconsistent outlier.

Root Cause

The incorrect mask in pmd_modify() drops _PAGE_DIRTY unconditionally. The shadow-stack encoding model relies on pmd_mksaveddirty() and pmd_clear_saveddirty() toggling between hardware-dirty and saved-dirty states based on the write bit. With the dirty bit erased before the transition, the folio appears clean to reclaim.

Attack Vector

This is a kernel memory management bug that causes data loss rather than a traditional attack surface. The failure sequence proceeds as follows. An application writes to a buffer backed by a PMD-mapped THP, which sets _PAGE_DIRTY in hardware. It then calls madvise(buf, size, MADV_FREE), which clears the dirty bit but leaves the mapping writable and marks the folio as lazyfree. The application writes to the buffer again, so hardware re-sets _PAGE_DIRTY.

A subsequent mprotect() call or NUMA hinting fault invokes pmd_modify(), which drops the dirty bit. Under memory reclaim pressure, __discard_anon_folio_pmd_locked() finds no dirty bit anywhere and frees the folio. Subsequent reads fault in zero pages, discarding the rewritten data. PMD-mapped file-backed THP are similarly affected because rewritten data is never written back.

Detection Methods for CVE-2026-97945

Indicators of Compromise

  • Unexpected zero regions appearing in large memory buffers after reclaim pressure in processes using THP and MADV_FREE
  • Application-level checksum or data-integrity failures in analytics or in-memory database workloads using huge pages
  • Lost writes in file-backed THP mappings after mprotect() or NUMA balancing activity

Detection Strategies

  • Audit workloads for use of madvise() with MADV_FREE combined with Transparent Huge Pages via /sys/kernel/mm/transparent_hugepage/enabled
  • Inspect running kernel version against the fixed stable commits 55ddbc2, a5ad97c, e4d569f, and f7491d7
  • Monitor memory pressure events in cgroups and correlate with application data integrity errors

Monitoring Recommendations

  • Enable application-level data integrity checks (CRCs, checksums) on large in-memory datasets in affected workloads
  • Track /proc/vmstat counters for THP activity (thp_fault_alloc, thp_split_pmd) and lazyfree reclaim
  • Collect kernel logs and reclaim telemetry on hosts running analytics frameworks such as Polars until patches land

How to Mitigate CVE-2026-97945

Immediate Actions Required

  • Apply the upstream kernel fix that preserves _PAGE_DIRTY in the pmd_modify() mask, aligning its behavior with pte_modify() and pud_modify()
  • Update to a stable kernel release that includes commits 55ddbc2, a5ad97c, e4d569f, and f7491d7
  • Prioritize patching hosts running data analytics workloads under memory pressure or in memcg-limited containers

Patch Information

The fix keeps _PAGE_DIRTY in the preserved mask within pmd_modify(). The existing pmd_mksaveddirty() and pmd_clear_saveddirty() pair then correctly performs the hardware-dirty to saved-dirty transition based on the write bit, preserving shadow-stack encoding rules. Linux distribution vendors are backporting the fix to supported stable kernel branches referenced in the kernel.org commits above.

Workarounds

  • Disable Transparent Huge Pages via echo never > /sys/kernel/mm/transparent_hugepage/enabled for affected workloads until patched kernels are deployed
  • Avoid MADV_FREE in applications where PMD-mapped THP may be in use; substitute MADV_DONTNEED where semantics permit
  • Reduce memory reclaim pressure by tuning cgroup memory limits and vm.swappiness to lower the chance of lazyfree folio discard
bash
# Disable Transparent Huge Pages as a temporary mitigation
echo never | sudo tee /sys/kernel/mm/transparent_hugepage/enabled

# Verify current THP setting
cat /sys/kernel/mm/transparent_hugepage/enabled

# Confirm patched kernel version is running
uname -r

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.