File tree Expand file tree Collapse file tree 2 files changed +17
-15
lines changed
fortanix-vme/fortanix-vme-runner/src Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -111,20 +111,13 @@ impl AwsNitroCli {
111111}
112112
113113impl AmdSevSnpCli {
114- fn to_vm_run_args ( & self ) -> Result < VmRunArgs > {
114+ fn to_vm_run_args ( & self , firmware_image_path : PathBuf ) -> Result < VmRunArgs > {
115115 let cpu_count = self . common_args . cpu_count ;
116116 let memory_mib = self . common_args . memory ;
117117
118118 Ok ( VmRunArgs {
119119 uki_path : self . common_args . enclave_file . clone ( ) ,
120- firmware_image : match & self . amd_sev_snp_args . firmware_image_path {
121- Some ( path) => MaybeVendoredImage :: from ( path. clone ( ) ) ,
122- None => MaybeVendoredImage :: from_vendored ( if self . common_args . simulate {
123- VANILLA_OVMF
124- } else {
125- AMD_SEV_OVMF
126- } ) ?,
127- } ,
120+ firmware_image_path,
128121 memory_mib,
129122 cpu_count,
130123 } )
@@ -151,7 +144,18 @@ fn main() -> Result<()> {
151144}
152145
153146fn run_amd_sev_enclave ( amd_sev_cli : AmdSevSnpCli ) -> Result < ( ) > {
154- let run_args = amd_sev_cli. to_vm_run_args ( ) ?;
147+ // NOTE: it's important to not drop this while the VM runs, as it will remove the
148+ // temporary file that stores the firmware image
149+ let firmware_image = match amd_sev_cli. amd_sev_snp_args . firmware_image_path . clone ( ) {
150+ Some ( path) => MaybeVendoredImage :: from ( path) ,
151+ None => MaybeVendoredImage :: from_vendored ( if amd_sev_cli. common_args . simulate {
152+ VANILLA_OVMF
153+ } else {
154+ AMD_SEV_OVMF
155+ } ) ?,
156+ } ;
157+ let run_args = amd_sev_cli. to_vm_run_args ( firmware_image. path ( ) . to_owned ( ) ) ?;
158+
155159 let AmdSevSnpCli {
156160 common_args,
157161 amd_sev_snp_args,
Original file line number Diff line number Diff line change @@ -3,8 +3,6 @@ use std::{
33 process:: { Child , Command } ,
44} ;
55
6- use confidential_vm_blobs:: maybe_vendored:: MaybeVendoredImage ;
7-
86use super :: Platform ;
97
108/// The arguments used by the `run-enclave` command.
@@ -13,7 +11,7 @@ pub struct VmRunArgs {
1311 /// The path to the VM image file.
1412 pub uki_path : PathBuf ,
1513 /// The path to the enclave image file.
16- pub firmware_image : MaybeVendoredImage ,
14+ pub firmware_image_path : PathBuf ,
1715 /// The amount of memory that will be given to the enclave.
1816 pub memory_mib : u64 ,
1917 /// The number of CPUs that the enclave will receive.
@@ -35,7 +33,7 @@ enum RunMode {
3533fn build_qemu_command ( run_mode : RunMode , vm_run_args : VmRunArgs ) -> Command {
3634 let VmRunArgs {
3735 uki_path,
38- firmware_image ,
36+ firmware_image_path ,
3937 memory_mib,
4038 cpu_count,
4139 } = vm_run_args;
@@ -73,7 +71,7 @@ fn build_qemu_command(run_mode: RunMode, vm_run_args: VmRunArgs) -> Command {
7371
7472 // Images
7573 command. arg ( "-kernel" ) . arg ( uki_path) ;
76- command. arg ( "-bios" ) . arg ( firmware_image . path ( ) ) ;
74+ command. arg ( "-bios" ) . arg ( firmware_image_path ) ;
7775
7876 if let RunMode :: AmdSevVm = run_mode {
7977 command
You can’t perform that action at this time.
0 commit comments