Skip to content

Commit 1e23ca0

Browse files
authored
fix(guest-gin): move logger initialization (#755)
Do not run any complex tasks until the global allocator is initialized. Signed-off-by: Tomasz Andrzejak <[email protected]>
1 parent 367af9c commit 1e23ca0

File tree

1 file changed

+6
-6
lines changed
  • src/hyperlight_guest_bin/src

1 file changed

+6
-6
lines changed

src/hyperlight_guest_bin/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,6 @@ pub extern "C" fn entrypoint(peb_address: u64, seed: u64, ops: u64, max_log_leve
173173
// Set the seed for the random number generator for C code using rand;
174174
srand(srand_seed);
175175

176-
// set up the logger
177-
let max_log_level = LevelFilter::iter()
178-
.nth(max_log_level as usize)
179-
.expect("Invalid log level");
180-
init_logger(max_log_level);
181-
182176
// This static is to make it easier to implement the __chkstk function in assembly.
183177
// It also means that should we change the layout of the struct in the future, we
184178
// don't have to change the assembly code.
@@ -206,6 +200,12 @@ pub extern "C" fn entrypoint(peb_address: u64, seed: u64, ops: u64, max_log_leve
206200

207201
(*peb_ptr).guest_function_dispatch_ptr = dispatch_function as usize as u64;
208202

203+
// set up the logger
204+
let max_log_level = LevelFilter::iter()
205+
.nth(max_log_level as usize)
206+
.expect("Invalid log level");
207+
init_logger(max_log_level);
208+
209209
trace!("hyperlight_main",
210210
hyperlight_main();
211211
);

0 commit comments

Comments
 (0)