From 1600aa3dfcd2f4d9b21706073a428040bdd51226 Mon Sep 17 00:00:00 2001 From: Ludvig Liljenberg Date: Fri, 28 Mar 2025 12:55:47 -0700 Subject: [PATCH] Fix bug where memory could be reset during cancellation, but host still tried to read returnvalue Signed-off-by: Ludvig Liljenberg --- src/hyperlight_host/src/func/guest_dispatch.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/hyperlight_host/src/func/guest_dispatch.rs b/src/hyperlight_host/src/func/guest_dispatch.rs index 4462a8a66..65f0b2945 100644 --- a/src/hyperlight_host/src/func/guest_dispatch.rs +++ b/src/hyperlight_host/src/func/guest_dispatch.rs @@ -67,12 +67,13 @@ pub(crate) fn call_function_on_guest( timedout = true; match hv_handler.terminate_hypervisor_handler_execution_and_reinitialise( wrapper_getter.get_mgr_wrapper_mut().unwrap_mgr_mut(), - )? { - HyperlightError::HypervisorHandlerExecutionCancelAttemptOnFinishedExecution() => - {} + ) { + Ok( + HyperlightError::HypervisorHandlerExecutionCancelAttemptOnFinishedExecution(), + ) => {} // ^^^ do nothing, we just want to actually get the Flatbuffer return value // from shared memory in this case - e => return Err(e), + Ok(e) | Err(e) => return Err(e), } } e => return Err(e),