Skip to main content

CVE-2024-53687: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2024-53687cvecve-2024-53687
Published: Sat Jan 11 2025 (01/11/2025, 12:29:50 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: riscv: Fix IPIs usage in kfence_protect_page() flush_tlb_kernel_range() may use IPIs to flush the TLBs of all the cores, which triggers the following warning when the irqs are disabled: [ 3.455330] WARNING: CPU: 1 PID: 0 at kernel/smp.c:815 smp_call_function_many_cond+0x452/0x520 [ 3.456647] Modules linked in: [ 3.457218] CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Not tainted 6.12.0-rc7-00010-g91d3de7240b8 #1 [ 3.457416] Hardware name: QEMU QEMU Virtual Machine, BIOS [ 3.457633] epc : smp_call_function_many_cond+0x452/0x520 [ 3.457736] ra : on_each_cpu_cond_mask+0x1e/0x30 [ 3.457786] epc : ffffffff800b669a ra : ffffffff800b67c2 sp : ff2000000000bb50 [ 3.457824] gp : ffffffff815212b8 tp : ff6000008014f080 t0 : 000000000000003f [ 3.457859] t1 : ffffffff815221e0 t2 : 000000000000000f s0 : ff2000000000bc10 [ 3.457920] s1 : 0000000000000040 a0 : ffffffff815221e0 a1 : 0000000000000001 [ 3.457953] a2 : 0000000000010000 a3 : 0000000000000003 a4 : 0000000000000000 [ 3.458006] a5 : 0000000000000000 a6 : ffffffffffffffff a7 : 0000000000000000 [ 3.458042] s2 : ffffffff815223be s3 : 00fffffffffff000 s4 : ff600001ffe38fc0 [ 3.458076] s5 : ff600001ff950d00 s6 : 0000000200000120 s7 : 0000000000000001 [ 3.458109] s8 : 0000000000000001 s9 : ff60000080841ef0 s10: 0000000000000001 [ 3.458141] s11: ffffffff81524812 t3 : 0000000000000001 t4 : ff60000080092bc0 [ 3.458172] t5 : 0000000000000000 t6 : ff200000000236d0 [ 3.458203] status: 0000000200000100 badaddr: ffffffff800b669a cause: 0000000000000003 [ 3.458373] [<ffffffff800b669a>] smp_call_function_many_cond+0x452/0x520 [ 3.458593] [<ffffffff800b67c2>] on_each_cpu_cond_mask+0x1e/0x30 [ 3.458625] [<ffffffff8000e4ca>] __flush_tlb_range+0x118/0x1ca [ 3.458656] [<ffffffff8000e6b2>] flush_tlb_kernel_range+0x1e/0x26 [ 3.458683] [<ffffffff801ea56a>] kfence_protect+0xc0/0xce [ 3.458717] [<ffffffff801e9456>] kfence_guarded_free+0xc6/0x1c0 [ 3.458742] [<ffffffff801e9d6c>] __kfence_free+0x62/0xc6 [ 3.458764] [<ffffffff801c57d8>] kfree+0x106/0x32c [ 3.458786] [<ffffffff80588cf2>] detach_buf_split+0x188/0x1a8 [ 3.458816] [<ffffffff8058708c>] virtqueue_get_buf_ctx+0xb6/0x1f6 [ 3.458839] [<ffffffff805871da>] virtqueue_get_buf+0xe/0x16 [ 3.458880] [<ffffffff80613d6a>] virtblk_done+0x5c/0xe2 [ 3.458908] [<ffffffff8058766e>] vring_interrupt+0x6a/0x74 [ 3.458930] [<ffffffff800747d8>] __handle_irq_event_percpu+0x7c/0xe2 [ 3.458956] [<ffffffff800748f0>] handle_irq_event+0x3c/0x86 [ 3.458978] [<ffffffff800786cc>] handle_simple_irq+0x9e/0xbe [ 3.459004] [<ffffffff80073934>] generic_handle_domain_irq+0x1c/0x2a [ 3.459027] [<ffffffff804bf87c>] imsic_handle_irq+0xba/0x120 [ 3.459056] [<ffffffff80073934>] generic_handle_domain_irq+0x1c/0x2a [ 3.459080] [<ffffffff804bdb76>] riscv_intc_aia_irq+0x24/0x34 [ 3.459103] [<ffffffff809d0452>] handle_riscv_irq+0x2e/0x4c [ 3.459133] [<ffffffff809d923e>] call_on_irq_stack+0x32/0x40 So only flush the local TLB and let the lazy kfence page fault handling deal with the faults which could happen when a core has an old protected pte version cached in its TLB. That leads to potential inaccuracies which can be tolerated when using kfence.

AI-Powered Analysis

AILast updated: 06/28/2025, 11:11:31 UTC

Technical Analysis

CVE-2024-53687 is a vulnerability identified in the Linux kernel specifically affecting the RISC-V architecture implementation of kernel page protection mechanisms. The issue arises in the handling of Inter-Processor Interrupts (IPIs) within the function kfence_protect_page(), which is part of the kernel's memory error detection subsystem known as KFENCE. KFENCE is designed to detect memory safety errors by protecting allocated pages and triggering faults on invalid accesses. The vulnerability is triggered when flush_tlb_kernel_range() attempts to flush Translation Lookaside Buffers (TLBs) across all CPU cores using IPIs while interrupts are disabled. This leads to a kernel warning and potential instability due to improper synchronization of TLB flushes. The root cause is that the kernel flushes TLBs on all cores via IPIs even when interrupts are disabled, which is unsafe and causes warnings or faults. The fix involves modifying the behavior to flush only the local CPU's TLB and relying on lazy page fault handling to manage stale page table entries cached in other cores' TLBs. This approach accepts some potential inaccuracies in KFENCE's detection but avoids the unsafe IPI usage. The vulnerability is specific to the RISC-V architecture and the KFENCE subsystem in the Linux kernel. It does not appear to be exploitable for privilege escalation or arbitrary code execution but may cause kernel warnings, instability, or degraded memory error detection accuracy. No known exploits are reported in the wild, and no CVSS score has been assigned yet. The affected versions correspond to specific Linux kernel commits prior to the fix. This vulnerability highlights the challenges in safely synchronizing TLB flushes across multiple cores in certain architectures and the trade-offs in memory error detection mechanisms.

Potential Impact

For European organizations, the impact of CVE-2024-53687 is primarily related to system stability and reliability rather than direct security compromise. Organizations running Linux kernels on RISC-V hardware, particularly those utilizing KFENCE for memory error detection, may experience kernel warnings or instability due to improper TLB flush synchronization. This could lead to system crashes or degraded performance in critical infrastructure or embedded systems relying on RISC-V processors. Since the vulnerability does not enable privilege escalation or remote code execution, the confidentiality and integrity of data are unlikely to be directly affected. However, the potential for system instability could disrupt services, especially in environments where RISC-V Linux systems are deployed for industrial control, telecommunications, or research. The reduced accuracy of KFENCE's memory error detection might also delay the identification of memory corruption bugs, indirectly increasing risk over time. Given the emerging adoption of RISC-V in Europe, particularly in research institutions and some industrial sectors, affected organizations should be aware of this vulnerability to maintain system reliability and diagnostic capabilities.

Mitigation Recommendations

To mitigate CVE-2024-53687, European organizations should: 1) Ensure that Linux kernel versions are updated to include the patch that modifies TLB flush behavior to avoid using IPIs when interrupts are disabled on RISC-V architectures. This requires tracking kernel updates and applying them promptly in affected environments. 2) For systems where immediate patching is not feasible, consider disabling KFENCE or limiting its use to non-critical systems to avoid triggering the unsafe TLB flush behavior. 3) Monitor kernel logs for warnings related to smp_call_function_many_cond or TLB flush issues to detect potential occurrences of this problem. 4) Engage with hardware and software vendors to confirm RISC-V platform support and kernel compatibility, ensuring that future kernel releases incorporate the fix. 5) Implement robust system monitoring and fallback mechanisms to handle potential kernel instability gracefully, minimizing service disruption. 6) For development and testing environments, validate the behavior of KFENCE and TLB flushing on RISC-V platforms to identify any residual issues. These steps go beyond generic advice by focusing on architecture-specific kernel updates, operational monitoring, and vendor coordination.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2025-01-09T09:49:29.686Z
Cisa Enriched
false
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9823c4522896dcbdf0b7

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

Last enriched: 6/28/2025, 11:11:31 AM

Last updated: 8/17/2025, 2:39:07 AM

Views: 14

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