Skip to content

Commit

Permalink
Fix undefined behavior
Browse files Browse the repository at this point in the history
Fixes undefined behavior caused by the two lines being combined. If they
are combined, running `cargo test` will pass but `cargo test --release`
will result in the TDH.MNG.INIT SEAMCALL failing with an invalid
operand. XFAM if there's no print statements anywhere, and Attributes if
there are prints in the source code.

Signed-off-by: Jake Correnti <[email protected]>
  • Loading branch information
jakecorrenti committed Oct 9, 2024
1 parent 6b363ba commit bb1ed87
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/launch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ impl TdxVm {
}
}

let mut cmd = Cmd::from(&InitVm::new(&cpuid_entries));
let vm = InitVm::new(&cpuid_entries);
let mut cmd = Cmd::from(&vm);
unsafe {
fd.encrypt_op(&mut cmd)?;
}
Expand Down

0 comments on commit bb1ed87

Please sign in to comment.