Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.

Commit 2a79626

Browse files
committed
fix conflict from rebase
1 parent bcd906b commit 2a79626

File tree

2 files changed

+21
-19
lines changed
  • lucet-runtime

2 files changed

+21
-19
lines changed

lucet-runtime/lucet-runtime-macros/src/lib.rs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ pub fn lucet_hostcall(_attr: TokenStream, item: TokenStream) -> TokenStream {
8484
})
8585
.collect::<Vec<_>>();
8686

87-
let termination_details = if in_internals {
88-
quote! { lucet_runtime_internals::instance::TerminationDetails }
89-
} else {
90-
quote! { lucet_runtime::TerminationDetails }
91-
};
92-
9387
let raw_hostcall = quote! {
9488
#(#attrs)*
9589
#vis
@@ -99,20 +93,10 @@ pub fn lucet_hostcall(_attr: TokenStream, item: TokenStream) -> TokenStream {
9993

10094
let mut vmctx = #vmctx_mod::Vmctx::from_raw(vmctx_raw);
10195
#vmctx_mod::VmctxInternal::instance_mut(&mut vmctx).uninterruptable(|| {
102-
let res = std::panic::catch_unwind(move || {
96+
let mut vmctx = #vmctx_mod::Vmctx::from_raw(vmctx_raw);
97+
#vmctx_mod::VmctxInternal::instance_mut(&mut vmctx).in_hostcall(|| {
10398
#hostcall_ident(&mut #vmctx_mod::Vmctx::from_raw(vmctx_raw), #(#impl_args),*)
104-
});
105-
match res {
106-
Ok(res) => res,
107-
Err(e) => {
108-
match e.downcast::<#termination_details>() {
109-
Ok(details) => {
110-
#vmctx_mod::Vmctx::from_raw(vmctx_raw).terminate_no_unwind(*details)
111-
},
112-
Err(e) => std::panic::resume_unwind(e),
113-
}
114-
}
115-
}
99+
})
116100
})
117101
}
118102
};

lucet-runtime/lucet-runtime-tests/src/host.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,13 @@ macro_rules! host_tests {
403403

404404
/// Check that if two segments of hostcall stack are present when terminating, that they
405405
/// both get properly unwound.
406+
///
407+
/// Currently ignored as we don't allow nested hostcalls - the nested hostcall runs afoul
408+
/// of timeouts' domain-checking logic, which assumes beginning a hostscall will only
409+
/// happen from a guest context, but when initiated from a nested hostcall is actually a
410+
/// hostcall context
406411
#[test]
412+
#[ignore]
407413
fn nested_error_unwind() {
408414
let module =
409415
test_module_c("host", "nested_error_unwind.c").expect("build and load module");
@@ -432,7 +438,13 @@ macro_rules! host_tests {
432438

433439
/// Like `nested_error_unwind`, but the guest code callback in between the two segments of
434440
/// hostcall stack uses enough locals to require saving callee registers.
441+
///
442+
/// Currently ignored as we don't allow nested hostcalls - the nested hostcall runs afoul
443+
/// of timeouts' domain-checking logic, which assumes beginning a hostscall will only
444+
/// happen from a guest context, but when initiated from a nested hostcall is actually a
445+
/// hostcall context
435446
#[test]
447+
#[ignore]
436448
fn nested_error_unwind_regs() {
437449
let module =
438450
test_module_c("host", "nested_error_unwind.c").expect("build and load module");
@@ -461,7 +473,13 @@ macro_rules! host_tests {
461473

462474
/// Ensures that callee-saved registers are properly restored following a `catch_unwind`
463475
/// that catches a panic.
476+
///
477+
/// Currently ignored as we don't allow nested hostcalls - the nested hostcall runs afoul
478+
/// of timeouts' domain-checking logic, which assumes beginning a hostscall will only
479+
/// happen from a guest context, but when initiated from a nested hostcall is actually a
480+
/// hostcall context
464481
#[test]
482+
#[ignore]
465483
fn restore_callee_saved() {
466484
let module =
467485
test_module_c("host", "nested_error_unwind.c").expect("build and load module");

0 commit comments

Comments
 (0)