-
Notifications
You must be signed in to change notification settings - Fork 33
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
Introduce capability levels #355
Conversation
CC: @nwf @davidchisnall |
I think this is sufficiently expressive for what we need. We currently have orthogonal global and store local, and we use the following combinations:
We don’t use StoreLocal + Global because that would violate stack isolation. This means that, in our encoding, Global is an orthogonal permission but StoreLocal is a dependent permission that can exist only if you have both W and c permissions and so we can squeeze it into a corner of the encoding space. I believe that his scheme could be represented in this proposal. That said, I don’t think that this belongs in the core specification. We have shown that our use of local/global works well in the context of an RTOS but there is, as yet, very little demonstration that either this or the generalised multi-level variant is the right thing on larger systems. For example, when we worked through the levels we’d want in CheriBSD, we came up with a bunch of different concepts that would be nice to express:
A few people have used local-global in different ways in Morello, but this still feels like something that’s too close to research to be in the base spec. Putting it in a separate optional extension and aligning the permissions with CHERIoT so that we can appear as a two-level instantiation of that extension would be fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the proposal! A few questions after an initial read through.
I really don't follow the details of how this feature works, I guess it doesn't help that I'm not familiar with the feature in either CHERI v9 or CHERIoT. I think we need a better description. |
There are several intertwined mechanisms here; let me try to go through each in turn, specifically in the context of CHERIoT. At its most basic, CHERIoT uses two of the permission bits discussed here to differentiate stack memory from globals and heap, and from that builds a few useful properties. Specifically, the RTOS bootstrap ensures that...
First and foremost, this architectural feature propagates up to software as the property that pointers derived from stack pointers are confined to the stack (cannot be stored into globals or onto the heap). The policy asymmetric and the reverse is permitted: pointers to globals or into the heap can be stored to the stacks. Beyond that static partitioning, it is possible for software to clear the The addition of the "load global" ( [0]: One does need to be a little careful about passing [1]: There is some subtlety around the interaction of sealed capabilities and Whew. I hope that's useful? |
@nwf : Thanks for the explanation from CHERIoT's perspective. Then do you agree with @davidchisnall that the feature described in this PR is sufficiently expressive for what CHERIoT needs? |
I am now less convinced by my own argument, because I had not thought about the PermitLoadGlobal interaction. That's orthogonal to the other states that I described, giving a total of six |
I am not sure that all of the valid ones here can be represented. I wouldn't mind too much if we lost the Global & !StoreLocal & !LoadGlobal one, since its uses are a bit weird. |
@davidchisnall The intent is that only the Global & !StoreLocal & !LoadGlobal from your "desirable" table would be lost (specifically because clearing LG in this encoding requires clearing G). The rest should be possible. @arichardson I am happy with what is currently here, but I still think there is a missing permission that could be specified with the others here that I feel is a logical completion of these control flow bits, and by design costs no extra encoding bits here (As "E" controls all deep properties in this encoding).
Calling it CHERIoT, simply by construction, does not allow any (unsealed) capabilities on their Heap/Global areas that has the SL bit (@nwf / @davidchisnall you may wish to fact check that statement). Thus, they enforce the transitive property that nothing loaded by these non- However, I maintain the ability to quickly make a structure non-capturing (without needing assumptions about its construction) is useful. It allows delegating structures that are otherwise capturing in a way that means we don't have to search them after the delegation. The stack and register saves are very flat structures, and their life-cycles easy to reason about, but in the wider scope of all the different uses we imagine for Local/Global doing things by construction will be harder. We may not wish to mutate structures before declaring we are sure they cannot capture local things. LSL allows flipping a bit and knowing that the required property that a structure cannot be used to captured is true. @nwf on your [0], I raised this before, but CheriOT's "Zeroizing the stack between the caller's high water mark" being sufficient. This really only works if the callee does not get pointers past that water mark that can SL. Which it does, typically via arguments. Say you wanted to guarantee that a callee does not put pointers to its own stack frame (or another to some non-capture object) within the callers frame. (without also searching the entirety of the callers frame). how do you currently do that? If you strip SL from such an argument that points to the callers stack, it may still be used to load a capability with SL, which in turn could stash a local thing. Would LSL not be a really useful knob to have here? Like multiple levels, I don't think anything specified here prevents LSL being introduced at a later time, but I do think it is a logical completion. All the other permissions to do with movement of capabilities can have deep properties, why not SL? And, because no review can be made without bike-shedding: L for Load and Level is getting confusing. I liked E. |
We also use E for Exponent in the description of the bounds encoding. Its also interesting that we use Load for LoadMutable and Store for StoreLocal, but then we have Read and Write permissions... |
30d664f
to
1bdbe13
Compare
Split out into a separate extension and allocated RV32 encoding - still needs some cleanup but hopefully better than the previous version. |
8f7bf58
to
0d7f67b
Compare
Updated, hopefully this addresses the outstanding comments. I plan to create a new pull request for a "load-store-local" that can be used for a deep variant of store-local, but since this has not been validated in software yet I did not feel like including it in the base spec for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes! I just made some wording suggestions and typo/formatting fixes.
This adds the local/global mechanism of CHERIv9, augmented with the LoadGlobal feature of CHERIoT. The specification is written in such a way that a future extension could extend the bits used for local/global to more than one.
Co-authored-by: Andrés Amaya Garcia <[email protected]> Co-authored-by: Lawrence Esswood <[email protected]>
Co-authored-by: Andres Amaya Garcia <[email protected]> Signed-off-by: Alexander Richardson <[email protected]>
Also add missing EL=0 action.
48aea22
to
71bca18
Compare
This adds the local/global mechanism of CHERIv9, augmented with the LoadGlobal feature of CHERIoT. The specification is written in such a way that a future extension could extend the bits used for local/global to more than one. There is one difference compared to CHERIoT: it is not possible to have a "Global" capability without the "LoadGlobal" permission, but otherwise it is compatible. Co-authored-by: Andrés Amaya Garcia <[email protected]> Co-authored-by: Lawrence Esswood <[email protected]> Co-authored-by: Tariq Kurd <[email protected]>
This adds the local/global mechanism of CHERIv9, augmented with the LoadGlobal feature of CHERIoT. The specification is written in such a way that a future extension could extend the bits used for local/global to more than one.