wasmedge-rust-sdk
wasmedge-rust-sdk copied to clipboard
bug: Host function call through `VmDock::run_func` triggers segfault.
Summary
[1] 20267 segmentation fault (core dumped) cargo run
Out of scope ImportObject<T> value segfaults the host program.
Current State
In my wasm binary I have a function add_bindgen_host that calls a host function add_host which I then call using VmDock::run_func in WasmEdge.
The issue arises when the referenced value goes out of scope, any subsequent call triggers a segmentation fault.
I did not have this issue on wasmedge 0.8.1 as the variable ownership was directly transfered (vs borrowed in the current API),
Expected State
Run bindgen -- say: 3
Reproduction steps
- (guest) Create an extern function
host_addto be defined in (host) - (guest) Create a function
add_bindgen_hostwithwasmedge_bindgenmacro, that calls the host functionhost_add - (host) define
host_add - (host) define
init_vmfunction that returns aVm,host_addimport happens inside that function - (host) in
main, create aVmDock, and runadd_bindgen_host, the program should segfault with exit code 11
Screenshots
No response
Any logs you want to share for showing the specific issue
No response
Components
Rust SDK
WasmEdge Version or Commit you used
0.13.5
Operating system information
Pop!_OS 22.04
Hardware Architecture
x86_x64
Compiler flags and options
No response
Hi @apepkuss Please check this issue.