[Bug]: Trap redirection ignores vectored stvec and vstvec modes
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- rust
- Domain
- embedded-iot, operating-systems
Research direction
Start in firmware/runtime/src/trap/redirect.rs, where frame.epc is set from the supervisor trap vector base for both the S-mode and delegated VS paths. Read the stvec and vstvec MODE field alongside BASE, and check how the cause is available at that point. Done means vectored interrupts jump to BASE + 4 * cause while direct mode and synchronous exceptions still use BASE, or vectored mode is explicitly rejected or documented.
Written by the indexing model from the issue text.
Description
Description
firmware/runtime/src/trap/redirect.rs reads only the BASE field of stvec or vstvec when redirecting a trap. It does not inspect MODE. A payload that selects vectored mode consequently enters at the base address for every interrupt cause instead of at BASE + 4 * cause.
Steps to Reproduce
- Run a supervisor payload that sets
stvec.MODEto Vectored and installs distinct handlers for two interrupt causes. - Deliver one of the non-base interrupt causes through Runtime redirection.
- Observe the
mepcselected for the return to the payload.
The VS path has the same issue when vstvec.MODE is Vectored.
Expected Behavior
For vectored interrupt delivery, Runtime should select BASE + 4 * cause. Direct mode and synchronous exceptions should continue to use BASE.
Actual Behavior
Both paths always assign the vector base to frame.epc:
frame.epc = supervisor::TrapVector::read()
.get::<supervisor::BASE>()
.address()
.into();
The delegated VS path performs the equivalent vstvec base-only read.
RustSBI Version
main @ 721f68f7181817a727010372d9b485943a0e8242
Rust Toolchain
nightly-2026-05-11
Platform / Board
Prototyper with a supervisor payload using vectored interrupts
Execution Environment
QEMU
Additional Context
Read MODE along with BASE and apply the offset only for vectored interrupts. If vectored redirection is intentionally unsupported, reject that mode explicitly or document the limitation so the payload does not silently register handlers that cannot be reached.
- Dominant language
- Rust
- Stars
- 1.3k
- Forks
- 184
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 29
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rustsbi/rustsbi
-
[Bug]: RFENCE rejects the architecturally defined full-range size when start_addr is nonzeroPossibly taken @hongwei-2026 claimed this today. OpenC-bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
rustsbi/rustsbi#484 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 22/100
Maintainers usually reply within 1 day
-
C-enhancement help wanted
Difficulty 4/5 3-5 days Newbie friendliness 22/100
Maintainers usually reply within 1 day
-
C-bug help wanted P-high
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
[Bug]: Fix pmpm and smm region and slot managementPossibly taken @rkb32 claimed this today. OpenC-bug help wanted I-unsound P-high
Difficulty 5/5 Over a week Newbie friendliness 18/100
rustsbi/rustsbi#502 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
-
bug UI
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
wardian-app/Wardian#1746 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jlcodes99/cockpit-tools#3125 ·
Maintainers usually reply within 2 days