From bb1ed87cb670a588fca8cf004bc470d8f71e7d74 Mon Sep 17 00:00:00 2001 From: Jake Correnti Date: Wed, 9 Oct 2024 09:54:16 -0400 Subject: [PATCH] Fix undefined behavior 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 --- src/launch/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/launch/mod.rs b/src/launch/mod.rs index e4cc530..1b8ad57 100644 --- a/src/launch/mod.rs +++ b/src/launch/mod.rs @@ -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)?; }