CVE-2024-57883 in Linux
Summary
by MITRE • 01/15/2025
In the Linux kernel, the following vulnerability has been resolved:
mm: hugetlb: independent PMD page table shared count
The folio refcount may be increased unexpectly through try_get_folio() by caller such as split_huge_pages. In huge_pmd_unshare(), we use refcount to check whether a pmd page table is shared. The check is incorrect if the refcount is increased by the above caller, and this can cause the page table leaked:
BUG: Bad page state in process sh pfn:109324 page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x66 pfn:0x109324 flags: 0x17ffff800000000(node=0|zone=2|lastcpupid=0xfffff) page_type: f2(table) raw: 017ffff800000000 0000000000000000 0000000000000000 0000000000000000 raw: 0000000000000066 0000000000000000 00000000f2000000 0000000000000000 page dumped because: nonzero mapcount ... CPU: 31 UID: 0 PID: 7515 Comm: sh Kdump: loaded Tainted: G B 6.13.0-rc2master+ #7 Tainted: [B]=BAD_PAGE
Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015 Call trace: show_stack+0x20/0x38 (C) dump_stack_lvl+0x80/0xf8 dump_stack+0x18/0x28 bad_page+0x8c/0x130 free_page_is_bad_report+0xa4/0xb0 free_unref_page+0x3cc/0x620 __folio_put+0xf4/0x158 split_huge_pages_all+0x1e0/0x3e8 split_huge_pages_write+0x25c/0x2d8 full_proxy_write+0x64/0xd8 vfs_write+0xcc/0x280 ksys_write+0x70/0x110 __arm64_sys_write+0x24/0x38 invoke_syscall+0x50/0x120 el0_svc_common.constprop.0+0xc8/0xf0 do_el0_svc+0x24/0x38 el0_svc+0x34/0x128 el0t_64_sync_handler+0xc8/0xd0 el0t_64_sync+0x190/0x198
The issue may be triggered by damon, offline_page, page_idle, etc, which will increase the refcount of page table.
1. The page table itself will be discarded after reporting the "nonzero mapcount".
2. The HugeTLB page mapped by the page table miss freeing since we treat the page table as shared and a shared page table will not be unmapped.
Fix it by introducing independent PMD page table shared count. As described by comment, pt_index/pt_mm/pt_frag_refcount are used for s390 gmap, x86 pgds and powerpc, pt_share_count is used for x86/arm64/riscv pmds, so we can reuse the field as pt_share_count.
VulDB is the best source for vulnerability data and more expert information about this specific topic.
Analysis
by VulDB Data Team • 03/08/2026
The vulnerability CVE-2024-57883 resides within the Linux kernel's memory management subsystem, specifically affecting the HugeTLB (Huge Transparent Large Pages) implementation. This flaw manifests in the handling of PMD (Page Middle Directory) page table entries during operations involving huge page splitting and sharing. The core issue stems from improper refcount management within the hugetlb subsystem, where the reference count of folios can be unexpectedly incremented by callers such as split_huge_pages, leading to incorrect assumptions about page table sharing states.
The technical flaw occurs in the huge_pmd_unshare() function which relies on refcount values to determine if a PMD page table is shared. When the refcount is artificially increased by operations like try_get_folio() invoked during split_huge_pages processing, the system incorrectly identifies a page table as shared when it is actually not. This misidentification results in page table leakage, where page tables that should be freed remain allocated and unreferenced. The kernel's memory management subsystem becomes inconsistent, leading to the generation of error messages such as "Bad page state" and "nonzero mapcount" which indicate corrupted page structures and potential memory corruption.
The operational impact of this vulnerability extends beyond simple memory leaks to potentially compromise system stability and security. The page table leakage can cause memory exhaustion over time, leading to system performance degradation or even system crashes. The vulnerability can be triggered by various kernel subsystems including damon (Dynamic Access Monitor), offline_page, and page_idle, which all perform operations that increment page table refcounts. These operations create a scenario where the kernel's assumptions about page table sharing become invalid, causing the kernel to treat non-shared page tables as shared and thus preventing their proper cleanup and unmapping.
The fix implemented addresses this issue by introducing an independent PMD page table shared count mechanism. This solution leverages existing kernel infrastructure where different architectures already maintain separate tracking mechanisms for page table sharing. The approach reuses the pt_share_count field which is already used for x86, arm64, and riscv architectures, while maintaining compatibility with existing s390 gmap, x86 pgds, and powerpc implementations through the pt_index/pt_mm/pt_frag_refcount fields. This architectural approach aligns with the principle of minimizing code changes while ensuring correctness across different hardware platforms. The fix directly addresses the root cause by separating the concerns of reference counting for page table sharing from general folio reference counting, thereby preventing the incorrect sharing state detection that leads to page table leakage.
This vulnerability maps to CWE-129 and CWE-787 within the Common Weakness Enumeration framework, representing issues with improper input validation and out-of-bounds writes. From an ATT&CK perspective, this vulnerability could be exploited in the context of privilege escalation or denial of service, potentially allowing an attacker to cause system instability or resource exhaustion. The vulnerability demonstrates a classic case of improper resource management where the kernel's memory management subsystem fails to properly account for different types of reference counting operations, leading to resource leaks and system instability. The fix ensures that page table sharing decisions are based on accurate sharing state information rather than potentially corrupted reference count values, thereby maintaining the integrity of the kernel's memory management subsystem and preventing potential exploitation scenarios that could lead to system compromise or denial of service conditions.