CVE-2023-53583
Fecha de publicación:
04/10/2025
*** Pendiente de traducción *** In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
perf: RISC-V: Remove PERF_HES_STOPPED flag checking in riscv_pmu_start()<br />
<br />
Since commit 096b52fd2bb4 ("perf: RISC-V: throttle perf events") the<br />
perf_sample_event_took() function was added to report time spent in<br />
overflow interrupts. If the interrupt takes too long, the perf framework<br />
will lower the sysctl_perf_event_sample_rate and max_samples_per_tick.<br />
When hwc->interrupts is larger than max_samples_per_tick, the<br />
hwc->interrupts will be set to MAX_INTERRUPTS, and events will be<br />
throttled within the __perf_event_account_interrupt() function.<br />
<br />
However, the RISC-V PMU driver doesn&#39;t call riscv_pmu_stop() to update the<br />
PERF_HES_STOPPED flag after perf_event_overflow() in pmu_sbi_ovf_handler()<br />
function to avoid throttling. When the perf framework unthrottled the event<br />
in the timer interrupt handler, it triggers riscv_pmu_start() function<br />
and causes a WARN_ON_ONCE() warning, as shown below:<br />
<br />
------------[ cut here ]------------<br />
WARNING: CPU: 0 PID: 240 at drivers/perf/riscv_pmu.c:184 riscv_pmu_start+0x7c/0x8e<br />
Modules linked in:<br />
CPU: 0 PID: 240 Comm: ls Not tainted 6.4-rc4-g19d0788e9ef2 #1<br />
Hardware name: SiFive (DT)<br />
epc : riscv_pmu_start+0x7c/0x8e<br />
ra : riscv_pmu_start+0x28/0x8e<br />
epc : ffffffff80aef864 ra : ffffffff80aef810 sp : ffff8f80004db6f0<br />
gp : ffffffff81c83750 tp : ffffaf80069f9bc0 t0 : ffff8f80004db6c0<br />
t1 : 0000000000000000 t2 : 000000000000001f s0 : ffff8f80004db720<br />
s1 : ffffaf8008ca1068 a0 : 0000ffffffffffff a1 : 0000000000000000<br />
a2 : 0000000000000001 a3 : 0000000000000870 a4 : 0000000000000000<br />
a5 : 0000000000000000 a6 : 0000000000000840 a7 : 0000000000000030<br />
s2 : 0000000000000000 s3 : ffffaf8005165800 s4 : ffffaf800424da00<br />
s5 : ffffffffffffffff s6 : ffffffff81cc7590 s7 : 0000000000000000<br />
s8 : 0000000000000006 s9 : 0000000000000001 s10: ffffaf807efbc340<br />
s11: ffffaf807efbbf00 t3 : ffffaf8006a16028 t4 : 00000000dbfbb796<br />
t5 : 0000000700000000 t6 : ffffaf8005269870<br />
status: 0000000200000100 badaddr: 0000000000000000 cause: 0000000000000003<br />
[] riscv_pmu_start+0x7c/0x8e<br />
[] perf_adjust_freq_unthr_context+0x15e/0x174<br />
[] perf_event_task_tick+0x88/0x9c<br />
[] scheduler_tick+0xfe/0x27c<br />
[] update_process_times+0x9a/0xba<br />
[] tick_sched_handle+0x32/0x66<br />
[] tick_sched_timer+0x64/0xb0<br />
[] __hrtimer_run_queues+0x156/0x2f4<br />
[] hrtimer_interrupt+0xe2/0x1fe<br />
[] riscv_timer_interrupt+0x38/0x42<br />
[] handle_percpu_devid_irq+0x90/0x1d2<br />
[] generic_handle_domain_irq+0x28/0x36<br />
<br />
After referring other PMU drivers like Arm, Loongarch, Csky, and Mips,<br />
they don&#39;t call *_pmu_stop() to update with PERF_HES_STOPPED flag<br />
after perf_event_overflow() function nor do they add PERF_HES_STOPPED<br />
flag checking in *_pmu_start() which don&#39;t cause this warning.<br />
<br />
Thus, it&#39;s recommended to remove this unnecessary check in<br />
riscv_pmu_start() function to prevent this warning.
Gravedad: Pendiente de análisis
Última modificación:
06/10/2025