CVE-2023-53031
Publication date:
27/03/2025
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
powerpc/imc-pmu: Fix use of mutex in IRQs disabled section<br />
<br />
Current imc-pmu code triggers a WARNING with CONFIG_DEBUG_ATOMIC_SLEEP<br />
and CONFIG_PROVE_LOCKING enabled, while running a thread_imc event.<br />
<br />
Command to trigger the warning:<br />
# perf stat -e thread_imc/CPM_CS_FROM_L4_MEM_X_DPTEG/ sleep 5<br />
<br />
Performance counter stats for &#39;sleep 5&#39;:<br />
<br />
0 thread_imc/CPM_CS_FROM_L4_MEM_X_DPTEG/<br />
<br />
5.002117947 seconds time elapsed<br />
<br />
0.000131000 seconds user<br />
0.001063000 seconds sys<br />
<br />
Below is snippet of the warning in dmesg:<br />
<br />
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:580<br />
in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 2869, name: perf-exec<br />
preempt_count: 2, expected: 0<br />
4 locks held by perf-exec/2869:<br />
#0: c00000004325c540 (&sig->cred_guard_mutex){+.+.}-{3:3}, at: bprm_execve+0x64/0xa90<br />
#1: c00000004325c5d8 (&sig->exec_update_lock){++++}-{3:3}, at: begin_new_exec+0x460/0xef0<br />
#2: c0000003fa99d4e0 (&cpuctx_lock){-...}-{2:2}, at: perf_event_exec+0x290/0x510<br />
#3: c000000017ab8418 (&ctx->lock){....}-{2:2}, at: perf_event_exec+0x29c/0x510<br />
irq event stamp: 4806<br />
hardirqs last enabled at (4805): [] _raw_spin_unlock_irqrestore+0x94/0xd0<br />
hardirqs last disabled at (4806): [] perf_event_exec+0x394/0x510<br />
softirqs last enabled at (0): [] copy_process+0xc34/0x1ff0<br />
softirqs last disabled at (0): [] 0x0<br />
CPU: 36 PID: 2869 Comm: perf-exec Not tainted 6.2.0-rc2-00011-g1247637727f2 #61<br />
Hardware name: 8375-42A POWER9 0x4e1202 opal:v7.0-16-g9b85f7d961 PowerNV<br />
Call Trace:<br />
dump_stack_lvl+0x98/0xe0 (unreliable)<br />
__might_resched+0x2f8/0x310<br />
__mutex_lock+0x6c/0x13f0<br />
thread_imc_event_add+0xf4/0x1b0<br />
event_sched_in+0xe0/0x210<br />
merge_sched_in+0x1f0/0x600<br />
visit_groups_merge.isra.92.constprop.166+0x2bc/0x6c0<br />
ctx_flexible_sched_in+0xcc/0x140<br />
ctx_sched_in+0x20c/0x2a0<br />
ctx_resched+0x104/0x1c0<br />
perf_event_exec+0x340/0x510<br />
begin_new_exec+0x730/0xef0<br />
load_elf_binary+0x3f8/0x1e10<br />
...<br />
do not call blocking ops when !TASK_RUNNING; state=2001 set at [] do_nanosleep+0x60/0x1a0<br />
WARNING: CPU: 36 PID: 2869 at kernel/sched/core.c:9912 __might_sleep+0x9c/0xb0<br />
CPU: 36 PID: 2869 Comm: sleep Tainted: G W 6.2.0-rc2-00011-g1247637727f2 #61<br />
Hardware name: 8375-42A POWER9 0x4e1202 opal:v7.0-16-g9b85f7d961 PowerNV<br />
NIP: c000000000194a1c LR: c000000000194a18 CTR: c000000000a78670<br />
REGS: c00000004d2134e0 TRAP: 0700 Tainted: G W (6.2.0-rc2-00011-g1247637727f2)<br />
MSR: 9000000000021033 CR: 48002824 XER: 00000000<br />
CFAR: c00000000013fb64 IRQMASK: 1<br />
<br />
The above warning triggered because the current imc-pmu code uses mutex<br />
lock in interrupt disabled sections. The function mutex_lock()<br />
internally calls __might_resched(), which will check if IRQs are<br />
disabled and in case IRQs are disabled, it will trigger the warning.<br />
<br />
Fix the issue by changing the mutex lock to spinlock.<br />
<br />
[mpe: Fix comments, trim oops in change log, add reported-by tags]
Severity CVSS v4.0: Pending analysis
Last modification:
31/10/2025