In the Linux kernel, the following vulnerability has been resolved:
thermal: intelpowerclamp: Use getcpu() instead of smpprocessorid() to avoid crash
When CPU 0 is offline and intel_powerclamp is used to inject idle, it generates kernel BUG:
BUG: using smpprocessorid() in preemptible [00000000] code: bash/15687 caller is debugsmpprocessorid+0x17/0x20 CPU: 4 PID: 15687 Comm: bash Not tainted 5.19.0-rc7+ #57 Call Trace: <TASK> dumpstacklvl+0x49/0x63 dumpstack+0x10/0x16 checkpreemptiondisabled+0xdd/0xe0 debugsmpprocessorid+0x17/0x20 powerclampsetcurstate+0x7f/0xf9 [intel_powerclamp] ... ...
Here CPU 0 is the control CPU by default and changed to the current CPU, if CPU 0 offlined. This check has to be performed under cpusreadlock(), hence the above warning.
Use getcpu() instead of smpprocessor_id() to avoid this BUG.
[ rjw: Subject edits ]