Skip to content

Commit

Permalink
Zero out RBP in order not to compromise the environment encryption.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Sep 27, 2024
1 parent aed294f commit 26e632d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ impl JitProgram {
unsafe {
std::arch::asm!(
// RBP is saved and restored automatically by the surrounding function.
// It is zeroed out in order not to compromise the runtime environment (RDI) encryption.
"xor rbp, rbp",
// RBX must be saved and restored manually in the current version of rustc and llvm.
"push rbx",
"mov [{host_stack_pointer}], rsp",
Expand Down

0 comments on commit 26e632d

Please sign in to comment.