CVE-2024-50002
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
21/10/2024
Last modified:
03/11/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
static_call: Handle module init failure correctly in static_call_del_module()<br />
<br />
Module insertion invokes static_call_add_module() to initialize the static<br />
calls in a module. static_call_add_module() invokes __static_call_init(),<br />
which allocates a struct static_call_mod to either encapsulate the built-in<br />
static call sites of the associated key into it so further modules can be<br />
added or to append the module to the module chain.<br />
<br />
If that allocation fails the function returns with an error code and the<br />
module core invokes static_call_del_module() to clean up eventually added<br />
static_call_mod entries.<br />
<br />
This works correctly, when all keys used by the module were converted over<br />
to a module chain before the failure. If not then static_call_del_module()<br />
causes a #GP as it blindly assumes that key::mods points to a valid struct<br />
static_call_mod.<br />
<br />
The problem is that key::mods is not a individual struct member of struct<br />
static_call_key, it&#39;s part of a union to save space:<br />
<br />
union {<br />
/* bit 0: 0 = mods, 1 = sites */<br />
unsigned long type;<br />
struct static_call_mod *mods;<br />
struct static_call_site *sites;<br />
};<br />
<br />
key::sites is a pointer to the list of built-in usage sites of the static<br />
call. The type of the pointer is differentiated by bit 0. A mods pointer<br />
has the bit clear, the sites pointer has the bit set.<br />
<br />
As static_call_del_module() blidly assumes that the pointer is a valid<br />
static_call_mod type, it fails to check for this failure case and<br />
dereferences the pointer to the list of built-in call sites, which is<br />
obviously bogus.<br />
<br />
Cure it by checking whether the key has a sites or a mods pointer.<br />
<br />
If it&#39;s a sites pointer then the key is not to be touched. As the sites are<br />
walked in the same order as in __static_call_init() the site walk can be<br />
terminated because all subsequent sites have not been touched by the init<br />
code due to the error exit.<br />
<br />
If it was converted before the allocation fail, then the inner loop which<br />
searches for a module match will find nothing.<br />
<br />
A fail in the second allocation in __static_call_init() is harmless and<br />
does not require special treatment. The first allocation succeeded and<br />
converted the key to a module chain. That first entry has mod::mod == NULL<br />
and mod::next == NULL, so the inner loop of static_call_del_module() will<br />
neither find a module match nor a module chain. The next site in the walk<br />
was either already converted, but can&#39;t match the module, or it will exit<br />
the outer loop because it has a static_call_site pointer and not a<br />
static_call_mod pointer.
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.10 (including) | 5.15.168 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.113 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.55 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.10.14 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.11 (including) | 6.11.3 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/2b494471797bff3d257e99dc0a7abb0c5ff3b4cd
- https://git.kernel.org/stable/c/4b30051c4864234ec57290c3d142db7c88f10d8a
- https://git.kernel.org/stable/c/9c48c2b53191bf991361998f5bb97b8f2fc5a89c
- https://git.kernel.org/stable/c/b566c7d8a2de403ccc9d8a06195e19bbb386d0e4
- https://git.kernel.org/stable/c/c0abbbe8c98c077292221ec7e2baa667c9f0974c
- https://git.kernel.org/stable/c/ed4c8ce0f307f2ab8778aeb40a8866d171e8f128
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html



