CVE-2024-42096
x86: stop playing stack games in profile_pc()
Check your servers for CVE-2024-42096
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2024-42096 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
In the Linux kernel, the following vulnerability has been resolved:
x86: stop playing stack games in profile_pc()
The 'profile_pc()' function is used for timer-based profiling, which isn't really all that relevant any more to begin with, but it also ends up making assumptions based on the stack layout that aren't necessarily valid.
Basically, the code tries to account the time spent in spinlocks to the caller rather than the spinlock, and while I support that as a concept, it's not worth the code complexity or the KASAN warnings when no serious profiling is done using timers anyway these days.
And the code really does depend on stack layout that is only true in the simplest of cases. We've lost the comment at some point (I think when the 32-bit and 64-bit code was unified), but it used to say:
Assume the lock function has either no stack frame or a copy of eflags from PUSHF.
which explains why it just blindly loads a word or two straight off the stack pointer and then takes a minimal look at the values to just check if they might be eflags or the return pc:
Eflags always has bits 22 and up cleared unlike kernel addresses
but that basic stack layout assumption assumes that there isn't any lock debugging etc going on that would complicate the code and cause a stack frame.
It causes KASAN unhappiness reported for years by syzkaller [1] and others [2].
With no real practical reason for this any more, just remove the code.
Just for historical interest, here's some background commits relating to this code from 2006:
0cb91a229364 ("i386: Account spinlocks to the caller during profiling for !FP kernels") 31679f38d886 ("Simplify profile_pc on x86-64")
and a code unification from 2009:
ef4512882dbe ("x86: time_32/64.c unify profile_pc")
but the basics of this thing actually goes back to before the git tree.
Exploitation
EPSS 0.24%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 16.1% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 10 Sep 2024):
- Exploitation
- none: CISA did not find evidence of exploitation or a public proof of concept
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before 65ebdde16e7f5da99dbf8a548fb635837d78384e affected from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before 27c3be840911b15a3f24ed623f86153c825b6b29 affected from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before 49c09ca35a5f521d7fa18caf62fdf378f15e8aa4 affected from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before 2d07fea561d64357fb7b3f3751e653bf20306d77 affected from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before 161cef818545ecf980f0e2ebaf8ba7326ce53c2b affected from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before 16222beb9f8e5ceb0beeb5cbe54bef16df501a92 affected from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before a3b65c8cbc139bfce9541bc81c1bb766e5ba3f68 affected from 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2, before 093d9603b60093a9aaae942db56107f6432a5dca
Other versions: unaffected
|
| Linux |
affected 2.6.12 unaffected before 2.6.12 unaffected from 4.19.317 up to and including 4.19.* unaffected from 5.4.279 up to and including 5.4.* unaffected from 5.10.221 up to and including 5.10.* unaffected from 5.15.162 up to and including 5.15.* unaffected from 6.1.97 up to and including 6.1.* unaffected from 6.6.37 up to and including 6.6.* unaffected from 6.9.8 up to and including 6.9.* unaffected 6.10 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2024-42096 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2024-42096
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2024-42096
trivy image --scanners vuln IMAGE | grep CVE-2024-42096
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/65ebdde16e7f5da99dbf8a548fb635837d78384e git.kernel.org
- https://git.kernel.org/stable/c/27c3be840911b15a3f24ed623f86153c825b6b29 git.kernel.org
- https://git.kernel.org/stable/c/49c09ca35a5f521d7fa18caf62fdf378f15e8aa4 git.kernel.org
- https://git.kernel.org/stable/c/2d07fea561d64357fb7b3f3751e653bf20306d77 git.kernel.org
- https://git.kernel.org/stable/c/161cef818545ecf980f0e2ebaf8ba7326ce53c2b git.kernel.org
- https://git.kernel.org/stable/c/16222beb9f8e5ceb0beeb5cbe54bef16df501a92 git.kernel.org
- https://git.kernel.org/stable/c/a3b65c8cbc139bfce9541bc81c1bb766e5ba3f68 git.kernel.org
- https://git.kernel.org/stable/c/093d9603b60093a9aaae942db56107f6432a5dca git.kernel.org
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html lists.debian.org
- https://cert-portal.siemens.com/productcert/html/ssa-398330.html cert-portal.siemens.com
- https://cert-portal.siemens.com/productcert/html/ssa-265688.html cert-portal.siemens.com
Source: the record CVE-2024-42096 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse