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

Anup Patel anup at brainfault.org
Sat Oct 24 22:56:39 PDT 2026


On Sat, Oct 24, 2026 at 10:13 AM Sebastián Alba <sebasjosue84 at gmail.com> wrote:
>
> 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.

Indeed, the error returned by pmu_ctr_start_hw() must not be ignored in
sbi_pmu_ctr_cfg_match(). Please send a separate patch with appropriate
Fixes tag.

Also, pmu_ctr_write_hw() must also return error when cidx is out-of-bounds
so please send separate patch for this as well.

Regards,
Anup

>
> 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
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list