CVE-2025-39776 Overview
CVE-2025-39776 is a Linux kernel vulnerability in the mm/debug_vm_pgtable test module. The test allocates page table entries using its own manually allocated mm_struct but fails to clear those entries at destroy_args(). Stale entries remain in memory after the test exits. If another process later allocates an mm_struct with a pgd at the same address, it may operate on the stale page table entries, leading to memory corruption ([CWE-416]). The flaw is triggered on debug kernels built with CONFIG_DEBUG_VM_PGTABLE=y and is classified as a local, high-severity issue affecting confidentiality, integrity, and availability.
Critical Impact
Local attackers on affected debug-enabled kernels can trigger a use-after-free condition in the memory management subsystem, potentially leading to kernel memory corruption and privilege escalation.
Affected Products
- Linux Kernel (multiple stable branches, including 6.17-rc1 and 6.17-rc2)
- Debian Linux 11.0
- Siemens products referenced in advisory SSA-032379
Discovery Timeline
- 2025-09-11 - CVE-2025-39776 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-39776
Vulnerability Analysis
The vulnerability resides in the mm/debug_vm_pgtable self-test infrastructure of the Linux kernel. This test module allocates a temporary mm_struct and populates page table entries (PGD, PUD, PMD, PTE) manually to exercise the kernel's page table handling code paths. When the test completes and destroy_args() executes, it releases the allocated mm_struct but does not invoke the corresponding *_clear functions to zero out the page table entries.
The result is that the underlying page memory returned to the slab allocator still contains valid-looking page table entries. When a subsequent process acquires an mm_struct from the same slab cache and its pgd is placed at the same address, the kernel encounters stale entries during memory operations. In practice, this manifests as warnings such as BUG: non-zero pgtables_bytes on freeing mm and traces in free_pud_range and free_pgd_range, indicating that memory accounting and page table teardown assumptions have been violated.
Root Cause
The root cause is a missing cleanup step in destroy_args(). Manually populated page table entries are not cleared before the associated memory is freed, allowing stale pointers and metadata to persist across allocations. This constitutes a use-after-free condition once the freed slab memory is reused by another mm_struct.
Attack Vector
Exploitation requires local access and low privileges on a system running a Linux kernel compiled with CONFIG_DEBUG_VM_PGTABLE=y. A local attacker able to influence process creation and slab allocation patterns could deterministically obtain an mm_struct whose pgd lands on the affected slab region. The stale page table entries can then be leveraged to corrupt kernel memory, cause denial of service, or escalate privileges.
No verified public proof-of-concept code is available. Refer to the upstream kernel commits listed in the vendor advisories for technical details on the fix.
Detection Methods for CVE-2025-39776
Indicators of Compromise
- Kernel warning traces referencing free_pud_range, free_pgd_range, or exit_mmap on systems with CONFIG_DEBUG_VM_PGTABLE=y
- Log entries containing BUG: non-zero pgtables_bytes on freeing mm or BUG: Bad rss-counter state mm
- Unexpected process termination (do_exit, sys_exit_group) correlated with page table teardown warnings
Detection Strategies
- Monitor dmesg and journalctl -k output for VM debug warnings related to pgtables_bytes accounting anomalies
- Audit running kernel configurations to identify hosts built with debug VM options enabled in production
- Correlate kernel oops or panic events with process activity to detect anomalous mm_struct reuse patterns
Monitoring Recommendations
- Forward kernel logs to a centralized logging platform for retention and anomaly analysis
- Alert on kernel BUG or WARNING messages originating from memory management subsystems
- Track kernel version and configuration drift across the Linux fleet to identify unpatched hosts
How to Mitigate CVE-2025-39776
Immediate Actions Required
- Apply the upstream kernel patches referenced in the vendor advisories to all affected Linux systems
- Update Debian 11 systems using the packages published in the Debian LTS Announcement
- For Siemens industrial products, follow the remediation guidance in Siemens Security Advisory SSA-032379
- Restrict local access on debug-enabled kernels until patches are deployed
Patch Information
The fix modifies destroy_args() in mm/debug_vm_pgtable.c to clear page table entries before freeing the associated memory. Patches are available across multiple stable kernel branches via the upstream commits: 47d2a14, 561171d, 61a9f2e, 63962ff, 7bf57a0, and dde3085.
Workarounds
- Rebuild the kernel with CONFIG_DEBUG_VM_PGTABLE=n to disable the vulnerable test module in production environments
- Avoid loading debug or test kernel modules on production hosts
- Limit shell access and enforce least-privilege policies to reduce the local attack surface
# Verify whether the running kernel has the vulnerable debug option enabled
grep CONFIG_DEBUG_VM_PGTABLE /boot/config-$(uname -r)
# On Debian, update the kernel package to the fixed version
sudo apt-get update && sudo apt-get install --only-upgrade linux-image-$(uname -r | sed 's/.*-//')
sudo reboot
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

