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.
Metrics
Affected Vendors & Products
| Source | ID | Title |
|---|---|---|
Debian DLA |
DLA-4008-1 | linux-6.1 security update |
Ubuntu USN |
USN-7003-1 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7003-2 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7003-3 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7003-4 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7003-5 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7006-1 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7007-1 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7007-2 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7007-3 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7009-1 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7009-2 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7019-1 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7089-1 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7089-2 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7089-3 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7089-4 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7089-5 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7089-6 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7089-7 | Linux kernel (Low Latency) vulnerabilities |
Ubuntu USN |
USN-7090-1 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7095-1 | Linux kernel vulnerabilities |
Ubuntu USN |
USN-7156-1 | Linux kernel (GKE) vulnerabilities |
Solution
No solution given by the vendor.
Workaround
No workaround given by the vendor.
Mon, 03 Nov 2025 22:30:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| References |
|
Thu, 25 Sep 2025 20:15:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| First Time appeared |
Linux
Linux linux Kernel |
|
| Weaknesses | CWE-908 | |
| CPEs | cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 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:*:*:*:*:*:* |
|
| Vendors & Products |
Linux
Linux linux Kernel |
|
| Metrics |
cvssV3_1
|
cvssV3_1
|
Tue, 05 Nov 2024 10:15:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| Metrics |
ssvc
|
Tue, 24 Sep 2024 11:00:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| CPEs | cpe:/o:redhat:enterprise_linux:8 |
Tue, 24 Sep 2024 06:30:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| CPEs | cpe:/a:redhat:enterprise_linux:8::nfv |
Thu, 12 Sep 2024 08:30:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| Metrics |
ssvc
|
Thu, 12 Sep 2024 02:30:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| Weaknesses | CWE-125 | |
| Metrics |
cvssV3_1
|
cvssV3_1
|
Wed, 11 Sep 2024 13:30:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| Metrics |
ssvc
|
Wed, 11 Sep 2024 10:45:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| First Time appeared |
Redhat
Redhat enterprise Linux |
|
| CPEs | cpe:/a:redhat:enterprise_linux:9 cpe:/o:redhat:enterprise_linux:9 |
|
| Vendors & Products |
Redhat
Redhat enterprise Linux |
Status: PUBLISHED
Assigner: Linux
Published:
Updated: 2025-11-03T22:01:30.636Z
Reserved: 2024-07-29T15:50:41.173Z
Link: CVE-2024-42096
Updated: 2024-08-02T04:54:32.567Z
Status : Modified
Published: 2024-07-29T18:15:12.087
Modified: 2025-11-03T22:17:37.773
Link: CVE-2024-42096
OpenCVE Enrichment
No data.
Debian DLA
Ubuntu USN