From d1a417de97574fd12528a7f041360aa7b4c84eba Mon Sep 17 00:00:00 2001 From: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> Date: Mon, 5 May 2025 15:34:54 -0700 Subject: [PATCH] Add error logging when MapViewOfFileNuma2 fails Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> --- .../src/hypervisor/surrogate_process_manager.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hyperlight_host/src/hypervisor/surrogate_process_manager.rs b/src/hyperlight_host/src/hypervisor/surrogate_process_manager.rs index 4f3291034..7455148a4 100644 --- a/src/hyperlight_host/src/hypervisor/surrogate_process_manager.rs +++ b/src/hyperlight_host/src/hypervisor/surrogate_process_manager.rs @@ -169,8 +169,11 @@ impl SurrogateProcessManager { }; if allocated_address.Value.is_null() { + // Safety: `MapViewOfFileNuma2` will set the last error code if it fails. + let error = unsafe { windows::Win32::Foundation::GetLastError() }; log_then_return!( - "MapViewOfFileNuma2 failed for mem address {:?}", + "MapViewOfFileNuma2 failed with error code: {:?} for mem address {:?} ", + error, raw_source_address ); }