forked from AbsInt/CompCert
-
Notifications
You must be signed in to change notification settings - Fork 2
Backtranslation #1
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
Open
dongjaelee1
wants to merge
175
commits into
secure-compilation:ccs-blame
Choose a base branch
from
dongjaelee1:secure-compilation-dj
base: ccs-blame
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
Backtranslation #1
dongjaelee1
wants to merge
175
commits into
secure-compilation:ccs-blame
from
dongjaelee1:secure-compilation-dj
Conversation
This file contains hidden or 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
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.
Compiles except for
security/Blame.v
,security/Recomposition.v
.This PR is not ready for merge.
Theorem
backtranslation_proof
insecurity/BacktranslationProof2.v
proves that there exists a Clight program which can generate a trace with the same prefix as generated from an original (whole) Asm program:Assumptions
asm_program_is_wf
.This says that the Asm program should
signature_main
)This condition is essential for the counter-based backtranslation to work in the presence of CompCert-style external call semantics.
CompCert has relational-style semantics for user-given external calls, and for a program to process an external call, it needs some other witness of the same external call (which is usually not a problem in a simulation proof).
However, this implies that backtranslation must generate the same external calls to correctly follow the execution of the original Asm program.
The is a problematic for the counter-based backtranslation when the external call is silent.
Consider the following (pseudo-assembly) code:
If
some_external_call
does not generate any event, this code exhibits a silent divergence, where the trace has length 0.However, backtranslation still needs to generate a code which repeatedly calls
some_external_call
.This means that the counter used by the backtranslated program can blow up, exceeding the length of the original trace.
This second assumption resolves this issue by ensuring that the user-given external calls to generate at least one event.
Notes
step_fix
.Fixing the semantics and the compiler-correctness proofs should not be difficult.
Also, I am not aware of the most up-to-date Asm semantics, so someone should resolve conflicts.
Jérémy is aware of this issue, and I believe he can handle this.
common/Events.v
2-1. The following axiom is added to
extcall_properties
:This have been discussed before, and proofs are fixed accordingly.
2-2.
EF_memcpy
: the destination pointer should not be a block for a public symbol (EF_memcpy_dest_not_pub
).This change is mostly to reduce proof complexity.
Current proof assumes that any memory store is done by
Mem.storev
, but memcpy usesMem.storebyes
, becoming the only exception.Removing this will require nontrivial extensions in current proof.
2-3.
EF_vstore
: the stored valuev
should be whole against the memory chunkch
(Val.load_result ch v = v
), which usually means that the chunk size is 32/64 bit, or sign/zero-extension does not modify the value (EF_vstore_load_whole_chunk
).This change is needed to correctly generate C-level types.
In C-level, there can be multiple definitions of
EF_vstore
with different argument types, each reflecting the different chunk sizes.This information is used in the Clight semantics when calling
EF_vstore
.For instance, if
EF_vstore
is storing a signed 8-bit sized int, the global environment must have aEF_vstore
withTint 8-bit signed
type.However, those argument types are erased in the assembly level, and correctly backtranslating each definition of
EF_vstore
will also require nontrivial extensions in current proof.