Skip to content

Fix automotive & snake demo halting after 512 compartment faults#88

Merged
AlexJones0 merged 1 commit intolowRISC:mainfrom
AlexJones0:demo_switcher_fix
Apr 15, 2026
Merged

Fix automotive & snake demo halting after 512 compartment faults#88
AlexJones0 merged 1 commit intolowRISC:mainfrom
AlexJones0:demo_switcher_fix

Conversation

@AlexJones0
Copy link
Copy Markdown
Contributor

Fix the bug in the automotive demo (and the same issue in the Snake demo, though practically this will never appear).

See the comments (and provided links) for more info about this switcher limitation/interface. As can be seen, this is documented in the include header for the CHERIoT RTOS core switcher, but as far as I could tell from a quick skim this gotcha doesn't seem to be noted anywhere in the public-facing docs or the programmer's guide.

As noted in that documentation, we need to set a flag inside the error handler and then reset the switcher's errorHandlerCount attribute on the trusted stack frame from within our compartment, which we can do through a switcher_handler_invocation_count_reset libcall for. If we do this inside the handler we will instead get an integer overflow which will be interpreted by the switcher as a double fault.

See the comments (and provided links) for more info about this switcher
limitation/interface.

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
@AlexJones0 AlexJones0 requested a review from engdoreis April 15, 2026 10:03
@AlexJones0 AlexJones0 merged commit dc67977 into lowRISC:main Apr 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants