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

Stack zeroization on main with proofs #631

Merged
merged 10 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Stack zeroization for ARM: add tests
Co-authored-by: Santiago Arranz Olmos <santiago.arranz1@gmail.com>
  • Loading branch information
eponier and sarranz committed Nov 20, 2023
commit 3236156ecd77bee049f6dedeae47bea4b7d7c951
4 changes: 3 additions & 1 deletion compiler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ CHECKCATS ?= \
arm-m4 \
arm-m4-print \
x86-64-stack-zero-loop \
x86-64-stack-zero-unrolled
x86-64-stack-zero-unrolled \
arm-m4-stack-zero-loop \
arm-m4-stack-zero-unrolled

# --------------------------------------------------------------------
DESTDIR ?=
Expand Down
12 changes: 12 additions & 0 deletions compiler/config/tests.config
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,15 @@ args = -stack-zero=unrolled
okdirs = examples/**/x86-64 tests/success/**/x86-64
kodirs = tests/fail/**/x86-64
exclude = !tests/fail/warning

[test-arm-m4-stack-zero-loop]
bin = ./scripts/check-arm-m4
args = -stack-zero=loop
okdirs = examples/**/arm-m4 tests/success/**/arm-m4
kodirs = tests/fail/**/arm-m4

[test-arm-m4-stack-zero-unrolled]
bin = ./scripts/check-arm-m4
args = -stack-zero=unrolled
okdirs = examples/**/arm-m4 tests/success/**/arm-m4
kodirs = tests/fail/**/arm-m4
9 changes: 4 additions & 5 deletions compiler/src/pretyping.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1875,11 +1875,10 @@ let process_f_annot loc funname f_cc annot =
match strategy, size with
| None, None -> None
| None, Some _ ->
hierror
~loc:(Lone loc)
~funname
~kind:"unexpected annotation"
"\"stackzerosize\" cannot be used alone, you need to specify a strategy with attribute \"stackzero\""
warning Always
(L.i_loc0 loc)
"\"stackzerosize\" is ignored, since you did not specify a strategy with attribute \"stackzero\"";
None
| Some szs, _ -> Some (szs, size)
in

Expand Down
6 changes: 6 additions & 0 deletions compiler/tests/success/arm-m4/rand.jazz
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/* stack zeroization uses the alignment of the function as the default clear
step size. Due to the system call, the function is aligned on u128, but stack
zeroization is not implemented for u128 on ARM. Thus we introduce this
annotation to use u32 for the clear step size instead.
*/
#[stackzerosize=u32]
export
fn random32() -> reg u32 {
stack u8[4] s;
Expand Down