Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect and abort if trapping with untagged MTCC. #84

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/cheri_addr_checks.sail
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,22 @@ function ext_fetch_check_pc(start_pc, pc) = {
then {
/* We need to perform the permission checks only for the first granule. */
if not(PCC.tag)
then Ext_FetchAddr_Error(CapEx_TagViolation)
then {
if MTCC.tag
then Ext_FetchAddr_Error(CapEx_TagViolation)
else {
/*
* We're going to infinite loop, installing an untagged MTCC to PCC
* and coming right back here. Much better to just stop now.
*
* TODO: We'd rather go through the HTIF exit path, but the HTIF
* registers are not available to us at this point in the code, and
* changing that would require changes in the upstream submodule.
* Something to consider when we're rebasing against Zcheripurecap.
*/
not_implemented ("Untagged PCC and MTCC infinite loops; stopping now")
}
}
else if isCapSealed(PCC)
then internal_error(__FILE__, __LINE__, "PCC should never be sealed")
else if not(PCC.permit_execute)
Expand Down
3 changes: 2 additions & 1 deletion src/cheri_cap_common.sail
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,8 @@ function capToString (cap) = {
^ (if cap.access_system_regs then "a " else "- ")
^ (if cap.permit_seal then "S" else "-")
^ (if cap.permit_unseal then "U" else "-")
^ (if cap.perm_user0 then "0)" else "-)")
^ (if cap.perm_user0 then "0" else "-")
^ ")"
}

/*!
Expand Down
Loading