CVE-2024-42096
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
29/07/2024
Last modified:
03/11/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
x86: stop playing stack games in profile_pc()<br />
<br />
The &#39;profile_pc()&#39; function is used for timer-based profiling, which<br />
isn&#39;t really all that relevant any more to begin with, but it also ends<br />
up making assumptions based on the stack layout that aren&#39;t necessarily<br />
valid.<br />
<br />
Basically, the code tries to account the time spent in spinlocks to the<br />
caller rather than the spinlock, and while I support that as a concept,<br />
it&#39;s not worth the code complexity or the KASAN warnings when no serious<br />
profiling is done using timers anyway these days.<br />
<br />
And the code really does depend on stack layout that is only true in the<br />
simplest of cases. We&#39;ve lost the comment at some point (I think when<br />
the 32-bit and 64-bit code was unified), but it used to say:<br />
<br />
Assume the lock function has either no stack frame or a copy<br />
of eflags from PUSHF.<br />
<br />
which explains why it just blindly loads a word or two straight off the<br />
stack pointer and then takes a minimal look at the values to just check<br />
if they might be eflags or the return pc:<br />
<br />
Eflags always has bits 22 and up cleared unlike kernel addresses<br />
<br />
but that basic stack layout assumption assumes that there isn&#39;t any lock<br />
debugging etc going on that would complicate the code and cause a stack<br />
frame.<br />
<br />
It causes KASAN unhappiness reported for years by syzkaller [1] and<br />
others [2].<br />
<br />
With no real practical reason for this any more, just remove the code.<br />
<br />
Just for historical interest, here&#39;s some background commits relating to<br />
this code from 2006:<br />
<br />
0cb91a229364 ("i386: Account spinlocks to the caller during profiling for !FP kernels")<br />
31679f38d886 ("Simplify profile_pc on x86-64")<br />
<br />
and a code unification from 2009:<br />
<br />
ef4512882dbe ("x86: time_32/64.c unify profile_pc")<br />
<br />
but the basics of this thing actually goes back to before the git tree.
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:*:*:*:*:*:*:*:* | 4.19.317 (excluding) | |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.20 (including) | 5.4.279 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.221 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.162 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.97 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.37 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.9.8 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.10:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.10:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.10:rc3:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.10:rc4:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.10:rc5:*:*:*:*:*:* |
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/093d9603b60093a9aaae942db56107f6432a5dca
- https://git.kernel.org/stable/c/161cef818545ecf980f0e2ebaf8ba7326ce53c2b
- https://git.kernel.org/stable/c/16222beb9f8e5ceb0beeb5cbe54bef16df501a92
- https://git.kernel.org/stable/c/27c3be840911b15a3f24ed623f86153c825b6b29
- https://git.kernel.org/stable/c/2d07fea561d64357fb7b3f3751e653bf20306d77
- https://git.kernel.org/stable/c/49c09ca35a5f521d7fa18caf62fdf378f15e8aa4
- https://git.kernel.org/stable/c/65ebdde16e7f5da99dbf8a548fb635837d78384e
- https://git.kernel.org/stable/c/a3b65c8cbc139bfce9541bc81c1bb766e5ba3f68
- https://git.kernel.org/stable/c/093d9603b60093a9aaae942db56107f6432a5dca
- https://git.kernel.org/stable/c/161cef818545ecf980f0e2ebaf8ba7326ce53c2b
- https://git.kernel.org/stable/c/16222beb9f8e5ceb0beeb5cbe54bef16df501a92
- https://git.kernel.org/stable/c/27c3be840911b15a3f24ed623f86153c825b6b29
- https://git.kernel.org/stable/c/2d07fea561d64357fb7b3f3751e653bf20306d77
- https://git.kernel.org/stable/c/49c09ca35a5f521d7fa18caf62fdf378f15e8aa4
- https://git.kernel.org/stable/c/65ebdde16e7f5da99dbf8a548fb635837d78384e
- https://git.kernel.org/stable/c/a3b65c8cbc139bfce9541bc81c1bb766e5ba3f68
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html



