MartinKolbAtWork opened Issue #2855:
When calling
wasi_config_delete()
on a configuration that was created withwasi_config_new()
, I get aSegmentation fault
.Test Case
I used the official WASI example of wasmtime as a template:
main.cI added
wasi_config_delete(wasi_config);
in the line beforereturn 0
of themain
function. I did this because the documentation ofwasi_config_new()
reads:The caller is expected to deallocate the returned configuration
Steps to Reproduce
Running the program with this one additional line containing
wasi_config_delete
causes the process to crash with a segmentation fault.I discovered that
wasi_config_delete
can be called without problems up to the point whenwasi_instance_new
is called. It seems thatwasi_instance_new
takes ownership of parts of the data that is stored inwasi_config_t
.Expected Results
wasi_config_delete
should delete thewasi_config_t
structure without any negative side effects.Actual Results
Segfault!
Versions and Environment
Wasmtime version or commit: Fresh pull of wasmtime on April 19th (200d7f1df668db31baf14f1453ab8cee54724292)
Operating system: Ubuntu 20.04
Architecture: x86_64 GNU/Linux
MartinKolbAtWork labeled Issue #2855:
When calling
wasi_config_delete()
on a configuration that was created withwasi_config_new()
, I get aSegmentation fault
.Test Case
I used the official WASI example of wasmtime as a template:
main.cI added
wasi_config_delete(wasi_config);
in the line beforereturn 0
of themain
function. I did this because the documentation ofwasi_config_new()
reads:The caller is expected to deallocate the returned configuration
Steps to Reproduce
Running the program with this one additional line containing
wasi_config_delete
causes the process to crash with a segmentation fault.I discovered that
wasi_config_delete
can be called without problems up to the point whenwasi_instance_new
is called. It seems thatwasi_instance_new
takes ownership of parts of the data that is stored inwasi_config_t
.Expected Results
wasi_config_delete
should delete thewasi_config_t
structure without any negative side effects.Actual Results
Segfault!
Versions and Environment
Wasmtime version or commit: Fresh pull of wasmtime on April 19th (200d7f1df668db31baf14f1453ab8cee54724292)
Operating system: Ubuntu 20.04
Architecture: x86_64 GNU/Linux
alexcrichton commented on Issue #2855:
Are you using
wasm_engine_new_with_config
? If so that function is documented as taking ownership of thewasm_config_t
so you don't need to free it.
MartinKolbAtWork commented on Issue #2855:
Are you using
wasm_engine_new_with_config
? If so that function is documented as taking ownership of thewasm_config_t
so you don't need to free it.@alexcrichton Thanks for pointing this out. Actually I'm using
wasi_instance_new
, and this function has the same semantics of taking ownership of the config object. I should have read the f***ing manual in more detail ;-)I'll close this issue because this information resolves my problem. Thanks for looking into this.
MartinKolbAtWork closed Issue #2855:
When calling
wasi_config_delete()
on a configuration that was created withwasi_config_new()
, I get aSegmentation fault
.Test Case
I used the official WASI example of wasmtime as a template:
main.cI added
wasi_config_delete(wasi_config);
in the line beforereturn 0
of themain
function. I did this because the documentation ofwasi_config_new()
reads:The caller is expected to deallocate the returned configuration
Steps to Reproduce
Running the program with this one additional line containing
wasi_config_delete
causes the process to crash with a segmentation fault.I discovered that
wasi_config_delete
can be called without problems up to the point whenwasi_instance_new
is called. It seems thatwasi_instance_new
takes ownership of parts of the data that is stored inwasi_config_t
.Expected Results
wasi_config_delete
should delete thewasi_config_t
structure without any negative side effects.Actual Results
Segfault!
Versions and Environment
Wasmtime version or commit: Fresh pull of wasmtime on April 19th (200d7f1df668db31baf14f1453ab8cee54724292)
Operating system: Ubuntu 20.04
Architecture: x86_64 GNU/Linux
Last updated: Dec 23 2024 at 12:05 UTC