-
Notifications
You must be signed in to change notification settings - Fork 59
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
Stack zeroization on main with proofs #631
Conversation
The padding introduced by the alignment at the start of the export function is no longer included in the frame size of the export function, only in the max stack size. And we distinguish two max stack sizes: - stk_max : the amount of stack without the padding. This is the amount of stack that the function may write to. - total_stack : this is the amount of stack including the padding. This is the minimal stack space required for the execution of the compiled program. This is the amount to use in the correctness theorem. Co-authored-by: Santiago Arranz Olmos <santiago.arranz1@gmail.com>
Co-authored-by: Santiago Arranz Olmos <santiago.arranz1@gmail.com>
At the end of a call, rsp is back at the same point. Co-authored-by: Santiago Arranz Olmos <santiago.arranz1@gmail.com>
The fact that the memory that is not part of the source memory and not part of the stack is untouched is made explicit. This is needed to prove stack zeroization. Co-authored-by: Santiago Arranz Olmos <santiago.arranz1@gmail.com>
But just the generic part for the moment. The architecture-dependent parts (for x86 and ARM) are TODOs. Co-authored-by: Santiago Arranz Olmos <santiago.arranz1@gmail.com>
Code and proof Co-authored-by: Santiago Arranz Olmos <santiago.arranz1@gmail.com>
Co-authored-by: Santiago Arranz Olmos <santiago.arranz1@gmail.com>
Code and proof Co-authored-by: Santiago Arranz Olmos <santiago.arranz1@gmail.com>
Co-authored-by: Santiago Arranz Olmos <santiago.arranz1@gmail.com>
cf4c897
to
3236156
Compare
ARM part done. The PR is ready! |
Co-authored-by: Santiago Arranz Olmos <santiago.arranz1@gmail.com>
8b7dfb0
to
836dcfe
Compare
Great, I will try to read it soon. |
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.
I will not block the PR for my remark but it should be added in the TODO list.
I think it would be nice if some other reviewer are agree that the final lemma is what we want.
@@ -712,38 +857,63 @@ Lemma compile_prog_to_asmP | |||
-> exists xm', | |||
[/\ asmsem_exportcall xp fn xm xm' | |||
, mem_agreement m' (asm_mem xm') (asm_rip xm') (asm_globs xp), asm_scs xm' = scs' | |||
, (cparams.(stack_zero_info) fn <> None -> |
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.
I think this is not very nice to use cparams.(stack_zero_info) here.
Because there is no guaranties on its value.
I think we should add a boolean flag in the function (source level) and refers to it. So we will have the guaranty that if the source function is annotated then the stack is cleared.
I reviewed the statements (not proofs) of the lemmas in this PR and they look good to me. |
Finally merged into Jasmin 🎉 jasmin-lang/jasmin#631
This is (finally...) stack zeroization on latest main with proofs. The code is the last version (the one that makes Valgrind happy). The separation in commits should be meaningful.
I tried to consistently rename every "clear stack" to "stack zero".
The arm part is missing for the moment, so I put the PR as a draft for now.