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

Tag cleared for sealed caps written with CSpecialRW #119

Open
andresag01 opened this issue Oct 16, 2023 · 1 comment
Open

Tag cleared for sealed caps written with CSpecialRW #119

andresag01 opened this issue Oct 16, 2023 · 1 comment

Comments

@andresag01
Copy link

The hardware automatically legalizes some certain values when writing some of the CHERI SCRs in RISC-V. Example SCRs include xTVEC, xEPCC, etc and legalization can be due illegal address as described here or the trap MODE bits in xTVEC.

From the CHERI point of view, legalization means that the capability’s address is changed under the hood to a “legal” address, so there is a call to setCapAddr in Sail to check that the new address is still representable. See here -> then here for example.

However, sealed capabilities automatically get their tag cleared even when the "legalized" address is equal to the original address in the capability to be written. So, in practice, we cannot write sealed capabilities to SCRs like xTVEC and xEPCC. Is this intentional? That behavior looks a little odd to me...

@tariqkurd-repo
Copy link

tariqkurd-repo commented Nov 20, 2023

Xepcc can be sealed, Xtcc can't
The rules are

  1. integer writes using csr* instructions to address SCRs always cause CSetAddr with the mode field set to zero for Xtcc
  2. CSpecialRW writes write the whole cap, but still call CSetAddr with the mode field set to zero for Xtcc which has the side-effect of clearing the tag of sealed caps written to Xtcc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants