[PATCH 0/2] lib: sbi: Fix stale trap_context/prev_context linking

Nia Su nia.su at sifive.com
Thu Sep 10 22:32:12 PDT 2026


On Thu, Sep 10, 2026 at 3:34 AM Evgeny Voevodin
<evvoevod at tenstorrent.com> wrote:
>
> LGTM, but please resend with some changes in the descriptions.
>
> Patch 1/2: it clears trap_context and not tmp0 and tmp1, so the
> _scratch_init mirroring mentioned is not precise. Also it avoids a
> broken trap dump and a sbi_memcpy via scratch->trap_context with no
> NULL check, which corrupts memory silently.

Regarding the sbi_memcpy()/NULL-check issue, I grepped the current tree,
but sbi_domain_context_enter/exit() have no callers here, so I couldn’t
connect it to a concrete bug in this series. Did you have a specific caller
or path in mind? If so, I can adjust it accordingly.

Other than this point, everything else looks good. I’ll include them in v2.

Thanks,
Nia

> Add a Fixes tag, I think this is what gets fixed with this
> patch:
>
>       Fixes: 60ffc154c84d ("include: sbi: Add trap_context pointer in struct sbi_scratch")
>
> Reviewed-by: Evgeny Voevodin <evvoevod at tenstorrent.com>
>
>   Thanks,
>   Evgeny



More information about the opensbi mailing list