From 13df60389bd85a05edc82f60a8ec8d5bfb95ec4f Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Thu, 29 Feb 2024 13:26:23 +0000 Subject: [PATCH] In loading caps w/o cap authority, shed tag sooner FIXES https://github.com/microsoft/cheriot-sail/issues/13 --- src/cheri_insts.sail | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cheri_insts.sail b/src/cheri_insts.sail index 17ce99b..03b9552 100644 --- a/src/cheri_insts.sail +++ b/src/cheri_insts.sail @@ -798,6 +798,9 @@ function clause execute LoadCapImm(cd, cs1, imm) = { match c { MemValue(v) => { var cr = v; + if ptw_info.ptw_lc == PTW_LC_CLEAR | not(auth_val.permit_load_store_cap) then { + cr.tag = false; + }; if cr.tag & not(auth_val.permit_load_global) then { /* Without load-global authority, the loaded cap is always local */ cr.global = false; @@ -825,9 +828,6 @@ function clause execute LoadCapImm(cd, cs1, imm) = { cr.permit_store = false; cr.permit_load_mutable = false; }; - if ptw_info.ptw_lc == PTW_LC_CLEAR | not(auth_val.permit_load_store_cap) then { - cr.tag = false; - }; /* Sealing capabilities are excluded from revocation */ let isSealingCap = cr.permit_seal | cr.permit_unseal | cr.perm_user0; if (cr.tag & not(isSealingCap)) then {