Skip to main content

CVE-2024-38613: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2024-38613cvecve-2024-38613
Published: Wed Jun 19 2024 (06/19/2024, 13:56:14 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: m68k: Fix spinlock race in kernel thread creation Context switching does take care to retain the correct lock owner across the switch from 'prev' to 'next' tasks. This does rely on interrupts remaining disabled for the entire duration of the switch. This condition is guaranteed for normal process creation and context switching between already running processes, because both 'prev' and 'next' already have interrupts disabled in their saved copies of the status register. The situation is different for newly created kernel threads. The status register is set to PS_S in copy_thread(), which does leave the IPL at 0. Upon restoring the 'next' thread's status register in switch_to() aka resume(), interrupts then become enabled prematurely. resume() then returns via ret_from_kernel_thread() and schedule_tail() where run queue lock is released (see finish_task_switch() and finish_lock_switch()). A timer interrupt calling scheduler_tick() before the lock is released in finish_task_switch() will find the lock already taken, with the current task as lock owner. This causes a spinlock recursion warning as reported by Guenter Roeck. As far as I can ascertain, this race has been opened in commit 533e6903bea0 ("m68k: split ret_from_fork(), simplify kernel_thread()") but I haven't done a detailed study of kernel history so it may well predate that commit. Interrupts cannot be disabled in the saved status register copy for kernel threads (init will complain about interrupts disabled when finally starting user space). Disable interrupts temporarily when switching the tasks' register sets in resume(). Note that a simple oriw 0x700,%sr after restoring sr is not enough here - this leaves enough of a race for the 'spinlock recursion' warning to still be observed. Tested on ARAnyM and qemu (Quadra 800 emulation).

AI-Powered Analysis

AILast updated: 06/29/2025, 11:56:01 UTC

Technical Analysis

CVE-2024-38613 is a vulnerability identified in the Linux kernel specifically affecting the m68k architecture. The issue arises from a race condition involving spinlock handling during kernel thread creation and context switching. Normally, context switching in the Linux kernel disables interrupts to ensure the correct lock owner is maintained when switching between tasks. However, for newly created kernel threads, the saved status register (SR) does not have interrupts disabled, which leads to interrupts being enabled prematurely during the switch_to() function (also known as resume()). This premature enabling of interrupts allows a timer interrupt to invoke scheduler_tick() before the run queue lock is released in finish_task_switch(). Since the lock is still held by the current task, this results in a spinlock recursion warning and potential race condition. The root cause is that the kernel thread's saved status register is set with IPL (interrupt priority level) at 0, unlike normal processes where interrupts remain disabled during the switch. Attempts to mitigate this by simply resetting the SR bits are insufficient to fully prevent the race. The fix involves temporarily disabling interrupts during the register set switch in resume(), ensuring the lock ownership and interrupt state remain consistent. This vulnerability was introduced or at least exposed by commit 533e6903bea0, which restructured kernel thread creation and context switching. The issue has been tested on emulated m68k platforms such as ARAnyM and QEMU (Quadra 800 emulation). There are no known exploits in the wild at this time, and the vulnerability is specific to the m68k architecture kernel code path, which is less common in modern Linux deployments but still relevant for legacy or embedded systems using this architecture.

Potential Impact

For European organizations, the impact of CVE-2024-38613 depends largely on their use of Linux systems running on the m68k architecture. While m68k is not widely used in mainstream server or desktop environments, it remains relevant in certain embedded systems, legacy industrial control systems, or specialized hardware platforms. If these systems are part of critical infrastructure, manufacturing, or telecommunications equipment, the vulnerability could lead to kernel instability, unexpected spinlock recursion warnings, and potential denial of service due to kernel deadlocks or crashes. This could disrupt operations, especially in environments where uptime and reliability are critical. However, the vulnerability does not appear to allow privilege escalation or arbitrary code execution directly. The main risk is reduced system availability and reliability. European organizations with embedded Linux devices or legacy systems using m68k should be aware of this vulnerability to avoid unexpected system behavior or downtime. Since no known exploits exist, the immediate risk is low, but patching is recommended to prevent future exploitation or stability issues.

Mitigation Recommendations

1. Apply the official Linux kernel patches that address CVE-2024-38613 as soon as they become available for your distribution or kernel version. 2. For organizations running custom or embedded Linux kernels on m68k hardware, backport the fix from the mainline kernel to your maintained kernel branch. 3. Temporarily disable or isolate affected m68k-based systems from critical networks if patching is delayed, to reduce risk of exploitation or impact from instability. 4. Monitor kernel logs for spinlock recursion warnings or scheduler_tick() related anomalies that may indicate attempts to trigger the race condition. 5. Conduct thorough testing of kernel thread creation and context switching behavior in your environment after patching to ensure stability. 6. For embedded device manufacturers, update firmware images to include the patched kernel and coordinate with customers for timely updates. 7. Implement robust system monitoring and alerting to detect early signs of kernel instability or performance degradation related to this issue. 8. Review and limit access to systems running vulnerable kernels to trusted administrators only, reducing the risk of accidental or malicious triggering of the race condition.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-06-18T19:36:34.944Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9829c4522896dcbe2b22

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

Last enriched: 6/29/2025, 11:56:01 AM

Last updated: 8/15/2025, 11:18:15 PM

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