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

Commit f1e6950

Browse files
found some sharp bits
1 parent 2503952 commit f1e6950

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • lucet-runtime/lucet-runtime-internals/src/instance

lucet-runtime/lucet-runtime-internals/src/instance/signals.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,20 @@ extern "C" fn handle_signal(signum: c_int, siginfo_ptr: *mut siginfo_t, ucontext
229229

230230
// set up the faulting instruction pointer as the return address for `initiate_unwind`;
231231
// extremely unsafe, doesn't handle any edge cases yet
232+
//
233+
// TODO(Andy) can we avoid pushing onto the guest stack until knowing we want to force
234+
// an unwind? maybe a "last address" field on ctx. This can be populated on context
235+
// swap out (return address of lucet_context_swap) as well as here in the signal
236+
// handler.
237+
//
238+
// TODO(Andy) if the last address is obtained through the signal handler, for a signal
239+
// received exactly when we have just executed a `call` to a guest function, we
240+
// actually want to not push it (or push it +1?) lest we try to unwind with a return
241+
// address == start of function, where the system unwinder will unwind for the function
242+
// at address-1, (probably) fail to find the function, and `abort()`.
243+
//
244+
// if `rip` == the start of some guest function, we can probably just discard it and
245+
// use the return address instead.
232246
inst.push(rip as u64);
233247
}
234248
switch_to_host

0 commit comments

Comments
 (0)