Skip to main content

CVE-2024-39298: Vulnerability in Linux Linux

High
VulnerabilityCVE-2024-39298cvecve-2024-39298
Published: Tue Jun 25 2024 (06/25/2024, 14:22:40 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: mm/memory-failure: fix handling of dissolved but not taken off from buddy pages When I did memory failure tests recently, below panic occurs: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x8cee00 flags: 0x6fffe0000000000(node=1|zone=2|lastcpupid=0x7fff) raw: 06fffe0000000000 dead000000000100 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000009 00000000ffffffff 0000000000000000 page dumped because: VM_BUG_ON_PAGE(!PageBuddy(page)) ------------[ cut here ]------------ kernel BUG at include/linux/page-flags.h:1009! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:__del_page_from_free_list+0x151/0x180 RSP: 0018:ffffa49c90437998 EFLAGS: 00000046 RAX: 0000000000000035 RBX: 0000000000000009 RCX: ffff8dd8dfd1c9c8 RDX: 0000000000000000 RSI: 0000000000000027 RDI: ffff8dd8dfd1c9c0 RBP: ffffd901233b8000 R08: ffffffffab5511f8 R09: 0000000000008c69 R10: 0000000000003c15 R11: ffffffffab5511f8 R12: ffff8dd8fffc0c80 R13: 0000000000000001 R14: ffff8dd8fffc0c80 R15: 0000000000000009 FS: 00007ff916304740(0000) GS:ffff8dd8dfd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055eae50124c8 CR3: 00000008479e0000 CR4: 00000000000006f0 Call Trace: <TASK> __rmqueue_pcplist+0x23b/0x520 get_page_from_freelist+0x26b/0xe40 __alloc_pages_noprof+0x113/0x1120 __folio_alloc_noprof+0x11/0xb0 alloc_buddy_hugetlb_folio.isra.0+0x5a/0x130 __alloc_fresh_hugetlb_folio+0xe7/0x140 alloc_pool_huge_folio+0x68/0x100 set_max_huge_pages+0x13d/0x340 hugetlb_sysctl_handler_common+0xe8/0x110 proc_sys_call_handler+0x194/0x280 vfs_write+0x387/0x550 ksys_write+0x64/0xe0 do_syscall_64+0xc2/0x1d0 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff916114887 RSP: 002b:00007ffec8a2fd78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 000055eae500e350 RCX: 00007ff916114887 RDX: 0000000000000004 RSI: 000055eae500e390 RDI: 0000000000000003 RBP: 000055eae50104c0 R08: 0000000000000000 R09: 000055eae50104c0 R10: 0000000000000077 R11: 0000000000000246 R12: 0000000000000004 R13: 0000000000000004 R14: 00007ff916216b80 R15: 00007ff916216a00 </TASK> Modules linked in: mce_inject hwpoison_inject ---[ end trace 0000000000000000 ]--- And before the panic, there had an warning about bad page state: BUG: Bad page state in process page-types pfn:8cee00 page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x8cee00 flags: 0x6fffe0000000000(node=1|zone=2|lastcpupid=0x7fff) page_type: 0xffffff7f(buddy) raw: 06fffe0000000000 ffffd901241c0008 ffffd901240f8008 0000000000000000 raw: 0000000000000000 0000000000000009 00000000ffffff7f 0000000000000000 page dumped because: nonzero mapcount Modules linked in: mce_inject hwpoison_inject CPU: 8 PID: 154211 Comm: page-types Not tainted 6.9.0-rc4-00499-g5544ec3178e2-dirty #22 Call Trace: <TASK> dump_stack_lvl+0x83/0xa0 bad_page+0x63/0xf0 free_unref_page+0x36e/0x5c0 unpoison_memory+0x50b/0x630 simple_attr_write_xsigned.constprop.0.isra.0+0xb3/0x110 debugfs_attr_write+0x42/0x60 full_proxy_write+0x5b/0x80 vfs_write+0xcd/0x550 ksys_write+0x64/0xe0 do_syscall_64+0xc2/0x1d0 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f189a514887 RSP: 002b:00007ffdcd899718 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f189a514887 RDX: 0000000000000009 RSI: 00007ffdcd899730 RDI: 0000000000000003 RBP: 00007ffdcd8997a0 R08: 0000000000000000 R09: 00007ffdcd8994b2 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffdcda199a8 R13: 0000000000404af1 R14: 000000000040ad78 R15: 00007f189a7a5040 </TASK> The root cause should be the below race: memory_failure try_memory_failure_hugetlb me_huge_page __page_handle_poison dissolve_free_hugetlb_folio drain_all_pages -- Buddy page can be isolated e.g. for compaction. take_page_off_buddy -- Failed as page is not in the ---truncated---

AI-Powered Analysis

AILast updated: 06/29/2025, 12:26:25 UTC

Technical Analysis

CVE-2024-39298 is a vulnerability in the Linux kernel's memory management subsystem, specifically within the handling of buddy pages during memory failure scenarios. The issue arises from improper handling of pages that have been dissolved but not correctly removed from the buddy allocator's free lists. This leads to a kernel panic triggered by a VM_BUG_ON_PAGE assertion failure, indicating a corrupted page state. The vulnerability manifests during memory failure tests or operations involving huge pages (hugetlb), where race conditions occur between memory failure handling and page management functions such as __del_page_from_free_list, dissolve_free_hugetlb_folio, and take_page_off_buddy. The root cause is a race condition in the sequence of memory failure processing, where a buddy page can be isolated for compaction or other operations but is not properly taken off the buddy list before being dissolved, resulting in inconsistent page states and ultimately kernel crashes. The detailed kernel stack traces and page flag dumps indicate that the page reference counts and map counts become invalid, causing the kernel to panic. This vulnerability affects Linux kernel versions around 6.9.0-rc4 and potentially others using similar memory management code paths. No known exploits in the wild have been reported yet, and no CVSS score has been assigned. The flaw is critical because it affects core kernel memory management, which is fundamental to system stability and security.

Potential Impact

For European organizations, the impact of CVE-2024-39298 could be significant, especially for those relying on Linux-based servers, cloud infrastructure, or embedded systems that utilize huge pages for performance optimization. A kernel panic caused by this vulnerability can lead to system crashes, resulting in denial of service (DoS) conditions. This can disrupt critical services, cause data loss, and reduce availability of IT infrastructure. Organizations running high-performance computing, virtualization hosts, or database servers on affected Linux kernels are particularly at risk. While there is no direct evidence of privilege escalation or data corruption beyond the crash, the instability can be exploited by attackers to cause persistent outages or to disrupt operations. Given the widespread use of Linux in European public sector, financial institutions, telecommunications, and industrial control systems, the vulnerability poses a risk to operational continuity and service reliability. Additionally, the complexity of the bug and its triggering conditions mean that it could be exploited in targeted attacks or during stress testing scenarios, potentially impacting cloud service providers and data centers across Europe.

Mitigation Recommendations

To mitigate CVE-2024-39298, European organizations should: 1) Apply the official Linux kernel patches as soon as they become available from trusted sources or Linux distributions, ensuring that the fix for the buddy page handling is included. 2) Avoid running untrusted or experimental memory failure tests on production systems until patched. 3) Monitor kernel logs for signs of memory failure warnings or VM_BUG_ON_PAGE panics related to buddy pages, which can indicate attempts to trigger this vulnerability. 4) Implement kernel live patching solutions where feasible to reduce downtime during patch deployment. 5) For environments using huge pages extensively, consider temporarily disabling huge page allocations or adjusting kernel parameters related to memory compaction and hugetlb until patches are applied. 6) Conduct thorough testing of updated kernels in staging environments to validate stability before production rollout. 7) Maintain robust backup and recovery procedures to minimize impact from unexpected kernel panics. 8) Collaborate with Linux distribution vendors and security teams to stay informed about updates and advisories related to this vulnerability.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-06-24T13:53:25.515Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9829c4522896dcbe2c5a

Added to database: 5/21/2025, 9:08:57 AM

Last enriched: 6/29/2025, 12:26:25 PM

Last updated: 8/2/2025, 6:39:39 AM

Views: 12

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats