aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_debug.cpp
diff options
context:
space:
mode:
authorYawning Angel <yawning@schwanenlied.me>2021-10-31 21:41:39 +0000
committerYawning Angel <yawning@schwanenlied.me>2021-10-31 22:57:13 +0000
commit672fc9fc4d20d06810a66aa6133a94a0565eae05 (patch)
treeddd9d9d9110cc8b5d8f508af0467588e2c65fac4 /src/llvm_backend_debug.cpp
parent796a0c3968243f540e68e584283d862f60bf3f26 (diff)
core/mem: Add zero_explicit
This call is intended to provide the ability to securely scrub memory without compiler interference, in a similar manner to explicit_bzero, memset_s, SecureZeroMemory. The approach taken is a volatile memset followed by a seqentially consistent memory fence, to prevent the call from being optimized away by DSE, and from being reordered. An identical approach is currently being used by the zeroize Rust crate, and is effective in practice. LLVM IR output: ``` ; Function Attrs: nounwind define internal i8* @mem.zero_explicit(i8* %0, i64 %1) #0 { decls: call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 %1, i1 true) fence seq_cst ret i8* %0 } ```
Diffstat (limited to 'src/llvm_backend_debug.cpp')
0 files changed, 0 insertions, 0 deletions