From d9cf3cff63ff752604224f4f3d264dc6c9d67c42 Mon Sep 17 00:00:00 2001 From: Tomasz Andrzejak Date: Thu, 31 Jul 2025 18:33:52 +0200 Subject: [PATCH] fix(guest-gin): move logger initialization Do not run any complex tasks until the global allocator is initialized. Signed-off-by: Tomasz Andrzejak --- src/hyperlight_guest_bin/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hyperlight_guest_bin/src/lib.rs b/src/hyperlight_guest_bin/src/lib.rs index fa5e3a6f5..27918ad3f 100644 --- a/src/hyperlight_guest_bin/src/lib.rs +++ b/src/hyperlight_guest_bin/src/lib.rs @@ -173,12 +173,6 @@ pub extern "C" fn entrypoint(peb_address: u64, seed: u64, ops: u64, max_log_leve // Set the seed for the random number generator for C code using rand; srand(srand_seed); - // set up the logger - let max_log_level = LevelFilter::iter() - .nth(max_log_level as usize) - .expect("Invalid log level"); - init_logger(max_log_level); - // This static is to make it easier to implement the __chkstk function in assembly. // It also means that should we change the layout of the struct in the future, we // 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 (*peb_ptr).guest_function_dispatch_ptr = dispatch_function as usize as u64; + // set up the logger + let max_log_level = LevelFilter::iter() + .nth(max_log_level as usize) + .expect("Invalid log level"); + init_logger(max_log_level); + trace!("hyperlight_main", hyperlight_main(); );