Skip to content

reusing a Module may trigger invalid memory access #4949

Open
@tzemanovic

Description

@tzemanovic

Describe the bug

Related to #4377 (see comment #4377 (comment)) re-running the same Module that's created with a Store which is dropped after the first run and new Store created for the second run causes a segfault with invalid memory access.

We manage to workaround this issue by keeping a Store that's used to compile cached Modules alive and instantiate a new Store when we want to run them.

wasmer -vV; rustc -vV

Steps to reproduce

I've added a small example that reproduces this here https://github.com/heliaxdev/wasmer/blob/24024841309bff268115ff25cdbb86b1b2db0d52/examples/invalid_memory_access.rs

Run with e.g. cargo run --example invalid-memory-access --features=singlepass

Expected behavior

Module can be re-used for multiple runs

Actual behavior

segfaults on a second loop

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority-highHigh priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions