Annotations for zeroing the stack of "sensitive" functions which deal in transient secrets

For normal stack slots this would just be some extra code in cg_clif. For register spill stack slots it would require a Cranelift pass to run after regalloc has created register spill slots. For registers there may need to be a new instruction to zero a specific register, or the Cranelift pass can add iconst/fconst/vconst instructions with specific registers for their SSA values after DCE has run. I also assume that the flags register will need to be cleared (new instruction) All together it should not be too hard to add this to Cranelift.

Edit: opened Make it possible to erase all sensitive information after function exit · Issue #1169 · bytecodealliance/wasmtime · GitHub

1 Like