Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

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 30, 2024
1 parent b07bd56 commit c516db4
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 @@ -111,6 +111,8 @@ impl JitProgram {
// RBP and RBX must be saved and restored manually in the current version of rustc and llvm.
"push rbx",
"push rbp",
// RBP is zeroed out in order not to compromise the runtime environment (RDI) encryption.
"xor rbp, rbp",
"mov [{host_stack_pointer}], rsp",
"add QWORD PTR [{host_stack_pointer}], -8", // We will push RIP in "call rbp" later
"mov [rsp-8], rax",
Expand Down

0 comments on commit c516db4

Please sign in to comment.