Only handle signals at pcs with trap information
Previously wasmtime would handle any signal originating from wasm JIT code. This would, however, handle bugs in JIT code as-if they were wasm traps. Instead this commit switches signal handling to specifically check for whether the precise program counter is expected to be a trap. This way if a program counter traps and it's not expected to trap the signal isn't handled and the process is aborted (presumably leading to further debugging of whomever happens to work on the JIT at that time).
This commit is contained in:
@@ -432,7 +432,7 @@ pub unsafe trait TrapInfo {
|
||||
|
||||
/// Returns whether the given program counter lies within wasm code,
|
||||
/// indicating whether we should handle a trap or not.
|
||||
fn is_wasm_code(&self, pc: usize) -> bool;
|
||||
fn is_wasm_trap(&self, pc: usize) -> bool;
|
||||
|
||||
/// Uses `call` to call a custom signal handler, if one is specified.
|
||||
///
|
||||
@@ -635,7 +635,7 @@ impl<'a> CallThreadState<'a> {
|
||||
}
|
||||
|
||||
// If this fault wasn't in wasm code, then it's not our problem
|
||||
if !self.trap_info.is_wasm_code(pc as usize) {
|
||||
if !self.trap_info.is_wasm_trap(pc as usize) {
|
||||
return ptr::null();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user