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

Nia Su nia.su at sifive.com
Fri Sep 4 01:16:42 PDT 2026


Patch 1 clears scratch->trap_context on warm boot, since
non-retentive suspend/resume jumps straight there without restoring
it, leaving a stale pointer misused as the next trap's prev_context.

Patch 2 fixes sbi_trap_rnmi_handler() to link prev_context on entry
and restore it on exit, the same way sbi_trap_handler() does.

Signed-off-by: Nia Su <nia.su at sifive.com>
---
Nia Su (2):
      firmware: Clear scratch->trap_context on warm boot
      lib: sbi: Fix stale prev_context in RNMI handler

 firmware/fw_base.S |  3 +++
 lib/sbi/sbi_trap.c | 10 ++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
---
base-commit: 35511bc6ee1c9c17b6a89b44c52e2044bb51b979
change-id: 20260902-trap-context-fix-b9e78441953e

--




More information about the opensbi mailing list