[PATCH] lib: sbi: reject PMU skip-match counter class mismatches

Sebastián Alba sebasjosue84 at gmail.com
Fri Oct 23 21:42:43 PDT 2026


Hi Anup, Atish,

This patch has been in patchwork as New since 2026-08-27 and the issue is
still present in master at 131bda94. I reproduced it independently in both
directions earlier in this thread and Pengpeng confirmed the analysis.

Resending with Atish's current address, since my earlier Cc to
atishp at rivosinc.com bounced with a 550.

One observation for whoever applies it. pmu_ctr_start_hw() does carry the
index guard, but its return value is discarded at the call site, so the
AUTO_START path fails silently where CLEAR_VALUE traps. This patch closes
the SKIP_MATCH route, and pmu_ctr_write_hw() still has no guard of its own.

Thanks,
Sebastian


El mié, 14 oct 2026 a las 3:02, Pengpeng Hou (<hppiscas at 163.com>) escribió:
>
> Hi Sebastian,
>
> Thanks for testing both directions and for the Tested-by.
>
> Yes, ctr_idx - num_hw_ctrs is evaluated as unsigned and wraps; it does
> not produce a negative array index. The class check rejects either
> mismatch before it reaches the counter-specific operations.
>
> Thanks,
> Pengpeng
>


-- 
Sebastián Alba



More information about the opensbi mailing list