forked from AbsInt/CompCert
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Changes to the compartment model #2
Open
jeremyThibault
wants to merge
87
commits into
secure-compilation
Choose a base branch
from
cross-external-call-removal
base: secure-compilation
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…rom external functions
…yntax, Events, and Memory
…d Allocation pass
…ck-translation after removal of compartments
It would be great if someone was willing to look at it quickly and check that everything makes sense! |
Co-authored-by: Arthur Azevedo de Amorim <arthur.aa@gmail.com>
…-backtranslation' into cross-external-call-removal
…ls (do not free non freeable blocks)
…-backtranslation' into ccs-submission
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The goal of this PR is to restore the ability to compile programs all the way from C to RISC-V assembly, which had been broken since the removal of the default compartment. Additionally, this PR removes the notion of "cross-compartment external call" entirely. This means that after merging this, every call to an external function is treated as a call within the calling compartment.
The PR achieve these goals in the following manner:
The new compartment model
We adopt a new generic lattice-based compartment model, and we instantiate it appropriately. The
COMPTYPE
module type incommon/AST.v
gives the interface of our compartment model:and it is instantiated in the
COMP
module incommon/AST.v
. We use the following definitions for thecompartment
type and theflowsto
property:The intuition behind the lattice is the following: the higher in the lattice, the more privileged the compartment is. Given two compartments
cp
andcp'
, ifcp ⊆ cp'
, thencp'
has access to at least everythingcp
has access to. This is done by replacing most of the checks of compartment equality (in memory operations or within-compartment calls, for instance) by checks of compartment flow.Compiler passes usually preserve compartments across languages. (i.e. they use compartment equality, not flow).
Changes to external calls
The changes to the semantics of all level w.r.t. external calls is best exemplified with Cminor.
First, callstates now record an additional element, the calling compartment:
This is because the calling compartment is not necessarily the one recorded in the continuation (for instance, in the case of tailcalls)
The relevant rules for steps of execution:
External functions have compartment
bottom
, so they are always allowed. When actually executing step, they are temporarily granted the calling compartment's privilege (this is useful to state the properties of external functions).