Stream: git-wasmtime

Topic: wasmtime / PR #3313 native hooks do some nonsense if they...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 01:31):

pchickey opened PR #3313 from pch/native_hooks_double_calls to main:

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 01:35):

pchickey edited PR #3313 from pch/native_hooks_double_calls to main:

entering vm
entering native
triggering a trap from entering_native hook
thread 'native_hooks::trap_when_returning_to_vm' panicked at 'illegal state: entering_native when in native', tests/all/native_hooks.rs:360:32
stack backtrace:
   0: std::panicking::begin_panic
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:541:12
   1: all::native_hooks::State::entering_native
             at ./tests/all/native_hooks.rs:360:32
   2: core::ops::function::FnMut::call_mut
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:150:5
   3: <alloc::boxed::Box<F,A> as core::ops::function::FnMut<Args>>::call_mut
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/alloc/src/boxed.rs:1582:9
   4: wasmtime::store::StoreInner<T>::entering_native_hook
             at ./crates/wasmtime/src/store.rs:788:13
   5: wasmtime::func::invoke_wasm_and_catch_traps
             at ./crates/wasmtime/src/func.rs:1058:9
   6: wasmtime::func::Func::call_impl
             at ./crates/wasmtime/src/func.rs:745:13
   7: wasmtime::func::Func::call
             at ./crates/wasmtime/src/func.rs:685:9
   8: all::native_hooks::trap_when_returning_to_vm
             at ./tests/all/native_hooks.rs:317:16
   9: all::native_hooks::trap_when_returning_to_vm::{{closure}}
             at ./tests/all/native_hooks.rs:282:1
  10: core::ops::function::FnOnce::call_once
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:227:5
  11: core::ops::function::FnOnce::call_once
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
test native_hooks::trap_when_returning_to_vm ... FAILED

failures:

failures:
    native_hooks::trap_when_returning_to_vm

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 01:36):

pchickey edited PR #3313 from pch/native_hooks_double_calls to main:

test native_hooks::trap_when_returning_to_vm ... FAILED

entering vm
entering native
triggering a trap from entering_native hook
thread 'native_hooks::trap_when_returning_to_vm' panicked at 'illegal state: entering_native when in native', tests/all/native_hooks.rs:360:32
stack backtrace:
   0: std::panicking::begin_panic
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:541:12
   1: all::native_hooks::State::entering_native
             at ./tests/all/native_hooks.rs:360:32
   2: core::ops::function::FnMut::call_mut
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:150:5
   3: <alloc::boxed::Box<F,A> as core::ops::function::FnMut<Args>>::call_mut
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/alloc/src/boxed.rs:1582:9
   4: wasmtime::store::StoreInner<T>::entering_native_hook
             at ./crates/wasmtime/src/store.rs:788:13
   5: wasmtime::func::invoke_wasm_and_catch_traps
             at ./crates/wasmtime/src/func.rs:1058:9
   6: wasmtime::func::Func::call_impl
             at ./crates/wasmtime/src/func.rs:745:13
   7: wasmtime::func::Func::call
             at ./crates/wasmtime/src/func.rs:685:9
   8: all::native_hooks::trap_when_returning_to_vm
             at ./tests/all/native_hooks.rs:317:16
   9: all::native_hooks::trap_when_returning_to_vm::{{closure}}
             at ./tests/all/native_hooks.rs:282:1
  10: core::ops::function::FnOnce::call_once
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:227:5
  11: core::ops::function::FnOnce::call_once
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

test native_hooks::trap_when_entering_native ... FAILED

entering vm
entering native
triggering a trap from native
thread 'native_hooks::trap_when_entering_native' panicked at 'illegal state: entering_native when in native', tests/all/native_hooks.rs:316:32
stack backtrace:
   0: std::panicking::begin_panic
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:541:12
   1: all::native_hooks::State::entering_native
             at ./tests/all/native_hooks.rs:316:32
   2: core::ops::function::FnMut::call_mut
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:150:5
   3: <alloc::boxed::Box<F,A> as core::ops::function::FnMut<Args>>::call_mut
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/alloc/src/boxed.rs:1582:9
   4: wasmtime::store::StoreInner<T>::entering_native_hook
             at ./crates/wasmtime/src/store.rs:788:13
   5: wasmtime::func::invoke_wasm_and_catch_traps
             at ./crates/wasmtime/src/func.rs:1058:9
   6: wasmtime::func::Func::call_impl
             at ./crates/wasmtime/src/func.rs:745:13
   7: wasmtime::func::Func::call
             at ./crates/wasmtime/src/func.rs:685:9
   8: all::native_hooks::trap_when_entering_native
             at ./tests/all/native_hooks.rs:275:16
   9: all::native_hooks::trap_when_entering_native::{{closure}}
             at ./tests/all/native_hooks.rs:241:1
  10: core::ops::function::FnOnce::call_once
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:227:5
  11: core::ops::function::FnOnce::call_once
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 01:37):

pchickey edited PR #3313 from pch/native_hooks_double_calls to main:

I modified the native_hooks test suite to emit traps when told to. This was missing from the original test suite and should be added.

Wasmtime's behavior was not what I expected - if either hook returns a trap, the entering_native hook is called one last time (after the trap has been emitted) as part of the call returning.

We should either fix this behavior, or document it. Probably document it.

test native_hooks::trap_when_returning_to_vm ... FAILED

entering vm
entering native
triggering a trap from entering_native hook
thread 'native_hooks::trap_when_returning_to_vm' panicked at 'illegal state: entering_native when in native', tests/all/native_hooks.rs:360:32
stack backtrace:
   0: std::panicking::begin_panic
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:541:12
   1: all::native_hooks::State::entering_native
             at ./tests/all/native_hooks.rs:360:32
   2: core::ops::function::FnMut::call_mut
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:150:5
   3: <alloc::boxed::Box<F,A> as core::ops::function::FnMut<Args>>::call_mut
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/alloc/src/boxed.rs:1582:9
   4: wasmtime::store::StoreInner<T>::entering_native_hook
             at ./crates/wasmtime/src/store.rs:788:13
   5: wasmtime::func::invoke_wasm_and_catch_traps
             at ./crates/wasmtime/src/func.rs:1058:9
   6: wasmtime::func::Func::call_impl
             at ./crates/wasmtime/src/func.rs:745:13
   7: wasmtime::func::Func::call
             at ./crates/wasmtime/src/func.rs:685:9
   8: all::native_hooks::trap_when_returning_to_vm
             at ./tests/all/native_hooks.rs:317:16
   9: all::native_hooks::trap_when_returning_to_vm::{{closure}}
             at ./tests/all/native_hooks.rs:282:1
  10: core::ops::function::FnOnce::call_once
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:227:5
  11: core::ops::function::FnOnce::call_once
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

test native_hooks::trap_when_entering_native ... FAILED

entering vm
entering native
triggering a trap from native
thread 'native_hooks::trap_when_entering_native' panicked at 'illegal state: entering_native when in native', tests/all/native_hooks.rs:316:32
stack backtrace:
   0: std::panicking::begin_panic
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:541:12
   1: all::native_hooks::State::entering_native
             at ./tests/all/native_hooks.rs:316:32
   2: core::ops::function::FnMut::call_mut
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:150:5
   3: <alloc::boxed::Box<F,A> as core::ops::function::FnMut<Args>>::call_mut
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/alloc/src/boxed.rs:1582:9
   4: wasmtime::store::StoreInner<T>::entering_native_hook
             at ./crates/wasmtime/src/store.rs:788:13
   5: wasmtime::func::invoke_wasm_and_catch_traps
             at ./crates/wasmtime/src/func.rs:1058:9
   6: wasmtime::func::Func::call_impl
             at ./crates/wasmtime/src/func.rs:745:13
   7: wasmtime::func::Func::call
             at ./crates/wasmtime/src/func.rs:685:9
   8: all::native_hooks::trap_when_entering_native
             at ./tests/all/native_hooks.rs:275:16
   9: all::native_hooks::trap_when_entering_native::{{closure}}
             at ./tests/all/native_hooks.rs:241:1
  10: core::ops::function::FnOnce::call_once
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:227:5
  11: core::ops::function::FnOnce::call_once
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 23:20):

pchickey updated PR #3313 from pch/native_hooks_double_calls to main.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2021 at 00:42):

pchickey updated PR #3313 from pch/native_hooks_double_calls to main.


Last updated: Dec 23 2024 at 13:07 UTC