Vulnerability · Published Oct 21, 2024 · Assigned by Linux

CVE-2024-50002static_call: Handle module init failure correctly in static_call_del_module()

Medium 5.5

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 15% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS NVD)5.5Medium
Exploit odds (30 days)0.2%top 85.4% 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: static_call: Handle module init failure correctly in static_call_del_module() Module insertion invokes static_call_add_module() to initialize the static calls in a module. static_call_add_module() invokes __static_call_init(), which allocates a struct static_call_mod to either encapsulate the built-in static call sites of the associated key into it so further modules can be added or to append the module to the module chain. If that allocation fails the function returns with an error code and the module core invokes static_call_del_module() to clean up eventually added static_call_mod entries. This works correctly, when all keys used by the module were converted over to a module chain before the failure. If not then static_call_del_module() causes a #GP as it blindly assumes that key::mods points to a valid struct static_call_mod. The problem is that key::mods is not a individual struct member of struct static_call_key, it's part of a union to save space: union { /* bit 0: 0 = mods, 1 = sites */ unsigned long type; struct static_call_mod *mods; struct static_call_site *sites; }; key::sites is a pointer to the list of built-in usage sites of the static call. The type of the pointer is differentiated by bit 0. A mods pointer has the bit clear, the sites pointer has the bit set. As static_call_del_module() blidly assumes that the pointer is a valid static_call_mod type, it fails to check for this failure case and dereferences the pointer to the list of built-in call sites, which is obviously bogus. Cure it by checking whether the key has a sites or a mods pointer. If it's a sites pointer then the key is not to be touched. As the sites are walked in the same order as in __static_call_init() the site walk can be terminated because all subsequent sites have not been touched by the init code due to the error exit. If it was converted before the allocation fail, then the inner loop which searches for a module match will find nothing. A fail in the second allocation in __static_call_init() is harmless and does not require special treatment. The first allocation succeeded and converted the key to a module chain. That first entry has mod::mod == NULL and mod::next == NULL, so the inner loop of static_call_del_module() will neither find a module match nor a module chain. The next site in the walk was either already converted, but can't match the module, or it will exit the outer loop because it has a static_call_site pointer and not a static_call_mod pointer.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12linux6.1.115-1DEBIAN-CVE-2024-50002
Debian:13linux6.11.4-1DEBIAN-CVE-2024-50002
Debian:14linux6.11.4-1DEBIAN-CVE-2024-50002
Ubuntu:22.04:LTSlinux5.15.0-127.137UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux6.8.0-54.56UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-allwinner-5.19no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-aws5.15.0-1073.79UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-aws6.8.0-1023.25UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-aws-5.19no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-aws-6.2no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-aws-6.5no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-aws-6.86.8.0-1023.25~22.04.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-azure5.15.0-1078.87UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-azure6.8.0-1025.30UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-azure-5.19no fix listedUBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-azure-6.116.11.0-1012.12~24.04.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-azure-6.2no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-azure-6.5no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-azure-6.86.8.0-1025.30~22.04.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-azure-fde5.15.0-1078.87.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-azure-fde-5.19no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-azure-fde-6.2no fix listedUBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-azure-nvidia6.8.0-1014.15UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-gcp5.15.0-1072.80UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-gcp6.8.0-1024.26UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-gcp-5.19no fix listedUBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-gcp-6.116.11.0-1011.11~24.04.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-gcp-6.2no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-gcp-6.5no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-gcp-6.86.8.0-1024.26~22.04.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-gke5.15.0-1070.76UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-gke6.8.0-1019.23UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-gkeop5.15.0-1056.63UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-gkeop6.8.0-1006.8UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-hwe-5.19no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-hwe-6.2no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-hwe-6.5no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-hwe-6.86.8.0-57.59~22.04.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-ibm5.15.0-1066.69UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-ibm6.8.0-1022.22UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-ibm-6.86.8.0-1023.23~22.04.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-intel-iotg5.15.0-1071.77UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-kvm5.15.0-1070.75UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-lowlatency5.15.0-127.137UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-lowlatency6.8.0-54.56.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-lowlatency-hwe-5.19no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.2no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.5no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.86.8.0-54.56.1~22.04.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-nvidia5.15.0-1068.69UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-nvidia6.8.0-1022.25UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-nvidia-6.116.11.0-1007.7UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-nvidia-6.2no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-nvidia-6.5no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-nvidia-6.86.8.0-1022.25~22.04.2UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-nvidia-lowlatency6.8.0-1022.25.2UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-nvidia-tegra5.15.0-1032.32UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-nvidia-tegra-igx5.15.0-1020.20UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-oem-5.17no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-oem-6.0no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-oem-6.1no fix listedUBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-oem-6.116.11.0-1015.15UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-oem-6.5no fix listedUBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-oem-6.86.8.0-1024.24UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-oracle5.15.0-1071.77UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-oracle6.8.0-1020.21UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-oracle-6.5no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-oracle-6.86.8.0-1020.21~22.04.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-raspi5.15.0-1066.69UBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-raspi6.8.0-1019.23UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-riscv6.8.0-53.55.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-riscv-5.19no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-riscv-6.5no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-riscv-6.86.8.0-53.55.1~22.04.1UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-starfive-5.19no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-starfive-6.2no fix listedUBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-starfive-6.5no fix listedUBUNTU-CVE-2024-50002
Ubuntu:24.04:LTSlinux-xilinx6.8.0-1017.18UBUNTU-CVE-2024-50002
Ubuntu:22.04:LTSlinux-xilinx-zynqmp5.15.0-1039.43UBUNTU-CVE-2024-50002

Affected products (as reported)

VendorProductVersions
Linux Linux 9183c3f9ed710a8edf1a61e8a96d497258d26e08 – before ed4c8ce0f307f2ab8778aeb40a8866d171e8f1289183c3f9ed710a8edf1a61e8a96d497258d26e08 – before b566c7d8a2de403ccc9d8a06195e19bbb386d0e49183c3f9ed710a8edf1a61e8a96d497258d26e08 – before c0abbbe8c98c077292221ec7e2baa667c9f0974c9183c3f9ed710a8edf1a61e8a96d497258d26e08 – before 2b494471797bff3d257e99dc0a7abb0c5ff3b4cd9183c3f9ed710a8edf1a61e8a96d497258d26e08 – before 9c48c2b53191bf991361998f5bb97b8f2fc5a89c9183c3f9ed710a8edf1a61e8a96d497258d26e08 – before 4b30051c4864234ec57290c3d142db7c88f10d8a
Linux Linux 5.10

References