Vulnerability · Published Jun 19, 2024 · Assigned by Linux

CVE-2024-38613m68k: Fix spinlock race in kernel thread creation

Medium 4.7

In plain English

A medium-severity security flaw in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.2% (higher than 8% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS NVD)4.7Medium
Exploit odds (30 days)0.2%top 92.5% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official 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).

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12linux6.1.94-1DEBIAN-CVE-2024-38613
Debian:13linux6.8.12-1DEBIAN-CVE-2024-38613
Debian:14linux6.8.12-1DEBIAN-CVE-2024-38613
Ubuntu:22.04:LTSlinux5.15.0-121.131UBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux6.8.0-40.40UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-allwinner-5.19no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-aws5.15.0-1069.75UBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux-aws6.8.0-1013.14UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-aws-5.19no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-aws-6.2no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-aws-6.5no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-aws-6.86.8.0-1013.14~22.04.1UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-azure5.15.0-1072.81UBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux-azure6.8.0-1012.14UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-azure-5.19no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-azure-6.2no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-azure-6.5no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-azure-6.86.8.0-1012.14~22.04.1UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-azure-fde5.15.0-1072.81.1UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-azure-fde-5.19no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-azure-fde-6.2no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-gcp5.15.0-1068.76UBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux-gcp6.8.0-1012.13UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-gcp-5.19no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-gcp-6.2no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-gcp-6.5no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-gcp-6.86.8.0-1012.13~22.04.1UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-gke5.15.0-1066.72UBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux-gke6.8.0-1008.11UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-gkeop5.15.0-1052.59UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-hwe-5.19no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-hwe-6.2no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-hwe-6.5no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-hwe-6.86.8.0-40.40~22.04.3UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-ibm5.15.0-1062.65UBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux-ibm6.8.0-1010.10UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-ibm-6.86.8.0-1010.10~22.04.1UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-intel-iotg5.15.0-1064.70UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-kvm5.15.0-1066.71UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-lowlatency5.15.0-121.131UBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux-lowlatency6.8.0-40.40.1UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-lowlatency-hwe-5.19no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.2no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.5no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.86.8.0-40.40.1~22.04.1UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-nvidia5.15.0-1064.65UBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux-nvidia6.8.0-1011.11UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-nvidia-6.2no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-nvidia-6.5no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-nvidia-6.86.8.0-1011.11~22.04.1UBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux-nvidia-lowlatency6.8.0-1011.11.1UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-nvidia-tegra5.15.0-1028.28UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-nvidia-tegra-igx5.15.0-1016.16UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-oem-5.17no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-oem-6.0no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-oem-6.1no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-oem-6.5no fix listedUBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux-oem-6.86.8.0-1010.10UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-oracle5.15.0-1067.73UBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux-oracle6.8.0-1010.10UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-oracle-6.5no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-oracle-6.86.8.0-1010.10~22.04.1UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-raspi5.15.0-1062.65UBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux-raspi6.8.0-1009.10UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2024-38613
Ubuntu:24.04:LTSlinux-riscv6.8.0-40.40.1UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-riscv-5.19no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-riscv-6.5no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-riscv-6.86.8.0-40.40.1~22.04.1UBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-starfive-5.19no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-starfive-6.2no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-starfive-6.5no fix listedUBUNTU-CVE-2024-38613
Ubuntu:22.04:LTSlinux-xilinx-zynqmp5.15.0-1035.39UBUNTU-CVE-2024-38613

Affected products (as reported)

VendorProductVersions
Linux Linux 533e6903bea0440816a0f517b0845ccea4cc7917 – before 2a8d1d95302c7d52c6ac8fa5cb4a6948ae0d3a14533e6903bea0440816a0f517b0845ccea4cc7917 – before 5213cc01d0464c011fdc09f318705603ed3a746b533e6903bea0440816a0f517b0845ccea4cc7917 – before 4eeffecc8e3cce25bb559502c2fd94a948bcde82533e6903bea0440816a0f517b0845ccea4cc7917 – before 77b2b67a0f8bce260c53907e5749d61466d90c87533e6903bea0440816a0f517b0845ccea4cc7917 – before 0d9ae1253535f6e85a016e09c25ecbe6f7f59ef0533e6903bea0440816a0f517b0845ccea4cc7917 – before f3baf0f4f92af32943ebf27b960e0552c6c082fd533e6903bea0440816a0f517b0845ccea4cc7917 – before f1d4274a84c069be0f6098ab10c3443fc1f7134c533e6903bea0440816a0f517b0845ccea4cc7917 – before 95f00caf767b5968c2c51083957b38be4748a78a
Linux Linux 3.7

References