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

Clarify interaction of levels with sealed capabilities #439

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion src/insns/atomic_exceptions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ If <<c_perm>> is not granted then store the memory tag as zero, and load `cd.tag
+
If the authorizing capability does not grant <<lm_perm>>, and the tag of `cd` is 1 and `cd` is not sealed, then an implicit <<ACPERM>> clearing <<w_perm>> and <<lm_perm>> is performed to obtain the intermediate permissions on `cd` (see <<LC>>).
+
If the authorizing capability does not grant <<el_perm>>, and the tag of `cd` is 1, then an implicit <<ACPERM>> clearing <<el_perm>> and restricting the <<section_cap_level>> to the level of the authorizing capability is performed to obtain the final permissions on `cd` (see <<LC>>).
If the authorizing capability does not grant <<el_perm>>, and the tag of `cd` is 1, then an implicit <<ACPERM>> restricting the <<section_cap_level>> to the level of the authorizing capability is performed.
If `cd` is not sealed, this implicit <<ACPERM>> also clears <<el_perm>> to obtain the final permissions on `cd` (see <<cap_level_load_summary>> and <<LC>>).
+
The stored tag is also set to zero if the authorizing capability does not have <<sl_perm>> set but the stored data has a <<section_cap_level>> of 0 (see <<SC>>).
endif::[]
Expand Down
3 changes: 3 additions & 0 deletions src/insns/load_tag_perms.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The tag value written to `cd` is 0 if the tag of the memory location loaded is
If the authorizing capability does not grant <<lm_perm>>, and the tag of `cd` is 1 and `cd` is not sealed, then an implicit <<ACPERM>> clearing <<w_perm>> and <<lm_perm>> is performed to obtain the intermediate permissions on `cd`.
+
If the authorizing capability does not grant <<el_perm>>, and the tag of `cd` is 1, then an implicit <<ACPERM>> clearing <<el_perm>> and restricting the <<section_cap_level>> to the level of the authorizing capability is performed to obtain the final permissions on `cd`.
+
If the authorizing capability does not grant <<el_perm>>, and the tag of `cd` is 1, then an implicit <<ACPERM>> restricting the <<section_cap_level>> to the level of the authorizing capability is performed.
If `cd` is not sealed, this implicit <<ACPERM>> also clears <<el_perm>> to obtain the final permissions on `cd` (see <<cap_level_load_summary>>).

NOTE: Missing <<lm_perm>> does not affect untagged values since this could result in surprising bit patterns when copying non-capability data.
Similarly, sealed capabilities are not modified as they are not directly dereferenceable.
Expand Down
18 changes: 7 additions & 11 deletions src/level-ext.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,16 @@ NOTE: A capability with <<section_cap_level,CL>>=1 is _global_ and with <<sectio

NOTE: if W=0 or C=0 then SL is irrelevant

.{cheri_levels_ext_name} `LVLBITS=1` summary table for loaded capabilities
[#cap_level_load_summary,width="100%",options=header,align=center,cols="1,1,1,1,1,6"]
.{cheri_levels_ext_name} additional rules for loading capabilities
[#cap_level_load_summary,width="100%",options=header,align=center,cols="1,1,1,1,1,1,6"]
|==============================================================================
4+|Auth cap field | Data cap field |
h|*R* h|*C* h|*EL* h|*CL* h| Tag h|Action
.5+.^|1 .5+.^| 1 | 1 | X | X |Load data capability unmodified
.4+.^| 0 | 1 | 1 |Load data capability with EL=0
| 1 | 0 |Load data capability unmodified
.2+.^| 0 | 1 |Load data capability with CL=0,EL=0
| 0 |Load data capability unmodified
4+|Auth cap field 2+| Data cap field |
h|*R* h|*C* h|*EL* h|*CL* h| Tag h| Sealed h|Action
.2+.^|1 .2+.^| 1 .2+.^| 0 .2+.^| X .2+.^| 1 | Yes |Load data capability with `CL=min(auth.CL, data.CL)`, EL unchanged
| No |Load data capability with `EL=0, CL=min(auth.CL, data.CL)`
6+| All other cases |Load data capability with EL, CL unmodified
|==============================================================================

NOTE: if R=0 or C=0 then EL and CL are irrelevant

[#section_ext_cheri_multiple_levels]
=== Extending {cheri_levels_ext_name} to more than two levels
When `LVLBITS>1`, the behaviour of <<ACPERM>> can no longer use masking to adjust the <<section_cap_level>> or <<sl_perm>>, but instead must perform an integer minimum operation on those `LVLBITS`-wide fields.
Expand Down
Loading