CVE-2023-53031 Information
Description
In the Linux kernel the following vulnerability has been resolved:
powerpc/imc-pmu: Fix use of mutex in IRQs disabled section
Current imc-pmu code triggers a WARNING with CONFIG_DEBUG_ATOMIC_SLEEP and CONFIG_PROVE_LOCKING enabled while running a thread_imc event.
Command to trigger the warning: perf stat -e thread_imc/CPM_CS_FROM_L4_MEM_X_DPTEG/ sleep 5
Performance counter stats for ‘sleep 5’:
0 thread_imc/CPM_CS_FROM_L4_MEM_X_DPTEG/
5.002117947 seconds time elapsed
0.000131000 seconds user
0.001063000 seconds sys
Below is snippet of the warning in dmesg:
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:580
in_atomic(): 1 irqs_disabled(): 1 non_block: 0 pid: 2869 name: perf-exec
preempt_count: 2 expected: 0
4 locks held by perf-exec/2869:
0: c00000004325c540 (&sig->cred_guard_mutex)+.+.-3:3 at: bprm_execve+0x64/0xa90
1: c00000004325c5d8 (&sig->exec_update_lock)++++-3:3 at: begin_new_exec+0x460/0xef0
2: c0000003fa99d4e0 (&cpuctx_lock)-…-2:2 at: perf_event_exec+0x290/0x510
3: c000000017ab8418 (&ctx->lock)….-2:2 at: perf_event_exec+0x29c/0x510
irq event stamp: 4806
hardirqs last enabled at (4805): [
The above warning triggered because the current imc-pmu code uses mutex lock in interrupt disabled sections. The function mutex_lock() internally calls __might_resched() which will check if IRQs are disabled and in case IRQs are disabled it will trigger the warning.
Fix the issue by changing the mutex lock to spinlock.
[mpe: Fix comments trim oops in change log add reported-by tags]
Reference
https://git.kernel.org/stable/c/424bcb570cb320d1d15238cd4c933522b90f78fa https://git.kernel.org/stable/c/76d588dddc459fefa1da96e0a081a397c5c8e216 https://git.kernel.org/stable/c/8cbeb60320ac45a8240b561c8ef466b86c34dedc https://git.kernel.org/stable/c/a90d339f1f66be4a946769b565668e2bd0686dfa https://git.kernel.org/stable/c/d0c6d2a31026102d4738b47a610bed4401b9834f
Share on: