Skip to content

Commit 44af2f5

Browse files
vmuralidavidchisnall
authored andcommitted
rearranged table
1 parent 323d576 commit 44af2f5

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

archdoc/chap-cheri-riscv.tex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -474,16 +474,16 @@ \subsection{Sealed capabilities}
474474
Because CHERIoT allows manipulating the status of the interrupt through a function call (and function return) by encoding the interrupt type in the otype, the following attack can occur: A caller calling an interrupt-disabling callee can set the return sentry of the callee to the same callee. This means, the callee will call itself on return all the while operating with interrupts disabled. This will lead to infinite repeated calls to the callee with interrupts disabled, violating availability. This attack can be prevented in CHERIoT by adding two new ``backwards-edge'' sentries and adding more checks on \insnriscvref{CJALR}, i.e. only the following combinations are allowed in \insnriscvref{CJALR}:
475475

476476
\begin{center}
477-
\begin{tabular}{|c|c|c|c|}
478-
\hline
479-
\asm{cs1} & \asm{cd} & Used for & Valid \cotype{}s \\
480-
\hline
481-
\asm{\$cra} & \asm{\$cnull} & Function return & Return sentries $(4, 5)$\\
482-
$\ne$ \asm{\$cra} & \asm{\$cnull} & Tail call & Unsealed or interrupt inheriting forward sentry $(0, 1)$\\
483-
any & \asm{\$cra} & Function call & Unsealed or forward sentries $(0, 1, 2, 3)$\\
484-
any & $\ne$ \asm{\$cnull} & Function call & Unsealed or interrupt inheriting forward sentry $(0, 1)$\\
485-
\hline
486-
\end{tabular}
477+
\begin{tabular}{|c|c|c|c|}
478+
\hline
479+
\asm{cs1} & \asm{cd} & Used for & Valid \cotype{}s \\
480+
\hline
481+
\asm{\$cra} & \asm{\$cnull} & Function return & Return sentries $(4, 5)$\\
482+
$\ne$ \asm{\$cra} & \asm{\$cnull} & Tail call & Unsealed or interrupt inheriting forward sentry $(0, 1)$\\
483+
any & $\ne$ \asm{\$cnull} & Function call & Unsealed or interrupt inheriting forward sentry $(0, 1)$\\
484+
any & \asm{\$cra} & Function call & Unsealed or forward sentries $(0, 1, 2, 3)$\\
485+
\hline
486+
\end{tabular}
487487
\end{center}
488488

489489
\subsection{Capability bounds}

src/cheri_insts.sail

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ union clause ast = CJALR : (bits(12), regidx, regidx)
138138
* - None of the following combinations hold:
139139
* 1. *cd* = *cnull*, *cs1* = *cra* and *cs1* is a backwards sentry (Function return aka *cret* is only permitted to backwards sentry)
140140
* 2. *cd* = *cnull*, *cs1* $ne$ *cra* and *cs1* is unsealed or a forwards interrupt inheriting sentry (Tail calls are only permitted to unsealed caps or interrupt handling sentry using a target register different from *cra*, with the return register *cra* set by a different instruction)
141-
* 3. *cd* = *cra* and *cs1* is unsealed or a forwards sentry (Function calls are only permitted to unsealed caps or forwards sentry, with link register *cra*)
142-
* 4. *cd* $\ne$ *cnull* and *cs1* is unsealed or a forwards interrupt inheriting sentry (Less restricted function calls to interrupt inheriting sentries)
141+
* 3. *cd* $\ne$ *cnull* and *cs1* is unsealed or a forwards interrupt inheriting sentry (Less restricted function calls to interrupt inheriting sentries)
142+
* 4. *cd* = *cra* and *cs1* is unsealed or a forwards sentry (Function calls are only permitted to unsealed caps or forwards sentry, with link register *cra*)
143143
* - *cs1*.**perms** does not grant **Permit_Execute**.
144144
* - *cs1*.**address** $+$ *imm* is unaligned, ignoring bit 0.
145145
*
@@ -162,8 +162,8 @@ function clause execute(CJALR(imm, cs1, cd)) = {
162162
} else if (isCapSealed(cs1_val) & imm != zeros()) |
163163
not ((cd == zreg & cs1 == ra & isCapBackwardSentry(cs1_val)) |
164164
(cd == zreg & cs1 != ra & (not(isCapSealed(cs1_val)) | isCapForwardInheritSentry(cs1_val))) |
165-
(cd == ra & (not(isCapSealed(cs1_val)) | isCapForwardSentry(cs1_val))) |
166-
(cd != zreg & (not(isCapSealed(cs1_val)) | isCapForwardInheritSentry(cs1_val)))) then {
165+
(cd != zreg & (not(isCapSealed(cs1_val)) | isCapForwardInheritSentry(cs1_val))) |
166+
(cd == ra & (not(isCapSealed(cs1_val)) | isCapForwardSentry(cs1_val)))) then {
167167
handle_cheri_reg_exception(CapEx_SealViolation, cs1);
168168
RETIRE_FAIL
169169
} else if not (cs1_val.permit_execute) then {

0 commit comments

Comments
 (0)