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

Removed that prefetch instructions can throw exceptions #7

Merged
merged 7 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
11 changes: 8 additions & 3 deletions src/insns/prefetch.i.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ effective address is the sum of the base address specified in `cs1` and the
sign-extended offset encoded in imm[11:0], where imm[4:0] equals 0b00000, is
likely to be accessed by an instruction fetch in the near future. The encoding
is only valid if imm[4:0]=0. The authorising capability for this operation is
`cs1`.
`cs1`. This instruction does not throw any exceptions. However, following
<<CHERI_SPEC>>, this instruction does not perform a prefetch if it is
not authorized by `cs1`. This instruction does not perform a memory access
if one or more of the following conditions of `cs1` are met:
* The tag is not set
* The sealed bit is set
* No bytes of the cache line requested is in bounds
* The X permission is not set
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be <<x_perm>> to get the cross reference


Legacy Mode Description::
A PREFETCH.I instruction indicates to hardware that the cache block whose
Expand All @@ -46,8 +53,6 @@ likely to be accessed by an instruction fetch in the near future. The encoding
is only valid if imm[4:0]=0. The authorising capability for this operation is
<<ddc>>.

:prefetch_i:
include::cbo_exceptions.adoc[]

Prerequisites for PREFETCH.I.CAP::
Zicbop, {cheri_base_ext_name}
Expand Down
11 changes: 8 additions & 3 deletions src/insns/prefetch.r.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ effective address is the sum of the base address specified in `cs1` and the
sign-extended offset encoded in imm[11:0], where imm[4:0] equals 0b00000, is
likely to be accessed by a data read (i.e. load) in the near future. The
encoding is only valid if imm[4:0]=0. The authorising capability for this
operation is `cs1`.
operation is `cs1`. This instruction does not throw any exceptions. However,
in following <<CHERI_SPEC>>, this instruction does not perform a prefetch
if it is not authorized by `cs1`. This instruction does not perform a memory
access if one or more of the following conditions of `cs1` are met:
* The tag is not set
* The sealed bit is set
* No bytes of the cache line requested is in bounds
* The R permission is not set
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be <<r_perm>> to get the cross reference


Legacy Mode Description::
A PREFETCH.R instruction indicates to hardware that the cache block whose
Expand All @@ -46,8 +53,6 @@ likely to be accessed by a data read (i.e. load) in the near future. The
encoding is only valid if imm[4:0]=0. The authorising capability for this
operation is <<ddc>>.

:prefetch_r:
include::cbo_exceptions.adoc[]

Prerequisites for PREFETCH.R.CAP::
Zicbop, {cheri_base_ext_name}
Expand Down
13 changes: 10 additions & 3 deletions src/insns/prefetch.w.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ effective address is the sum of the base address specified in `cs1` and the
sign-extended offset encoded in imm[11:0], where imm[4:0] equals 0b00000, is
likely to be accessed by a data write (i.e. store) in the near future. The
encoding is only valid if imm[4:0]=0. The authorising capability for this
operation is `cs1`.
operation is `cs1`. This instruction does not throw any exceptions. However,
following <<CHERI_SPEC>>, this instruction does not perform a prefetch if it
is not authorized by `cs1`. This instruction does not perform a memory access
if one or more of the following conditions of `cs1` are met:
* The tag is not set
* The sealed bit is set
* No bytes of the cache line requested is in bounds
* The W permission is not set
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be <<w_perm>> to get the cross reference


Legacy Mode Description::
A PREFETCH.W instruction indicates to hardware that the cache block whose
Expand All @@ -47,10 +54,10 @@ encoding is only valid if imm[4:0]=0. The authorising capability for this
operation is <<ddc>>.

Prerequisites for PREFETCH.W.CAP::
{cheri_base_ext_name}
Zicbop, {cheri_base_ext_name}

Prerequisites for PREFETCH.W::
{cheri_legacy_ext_name}
Zicbop, {cheri_legacy_ext_name}

Operation::
[source,sail]
Expand Down
7 changes: 7 additions & 0 deletions src/riscv-integration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,13 @@ NOTE: <<CBO.ZERO.CAP>>, <<CBO.ZERO>> issues as a cache line wide store

NOTE: ^1^Other CBOs (<<CBO.FLUSH.CAP>>, <<CBO.FLUSH>>, <<CBO.CLEAN.CAP>>, <<CBO.CLEAN>>, <<CBO.INVAL.CAP>>, <<CBO.INVAL>>) require at least one byte of the access to be in `auth_cap` bounds

[#CHERI_SPEC,reftext="CHERI Exceptions and speculative execution"]
=== CHERI Exceptions and speculative execution

CHERI adds architectural guarantees that can prove to be microarchitecturally useful.
Speculative-execution attacks can -- among other factors -- rely on instructions that fail CHERI permission checks not to take effect.
When implementing any of the extensions proposed here, microarchitects need to carefully consider the interaction of late-exception raising and side-channel attacks.

=== Physical Memory Attributes (PMA)

Typically, the entire memory space need not support tagged data. Therefore, it
Expand Down
Loading