bytecodealliance / bytecodealliance/wasmtime
Wasmtime: need mechanism to associate a runtime borrow checker with a linear memory
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 126
Description
Issue filed based on discussion: https://github.com/bytecodealliance/wasmtime/pull/1910#discussion_r444963814
The `wiggle` crate relies on performing run-time borrow checking of accesses into a linear memory for safety. Currently, there is no mechanism in Wasmtime which can associate a borrow checker with a linear memory. Presently, we create a fresh borrow checker each time we enter host code, but this requires the host code to never re-enter the same WebAssembly instance, a property which we cannot enforce statically or dynamically.
We need to design some mechanism by which the `wasmtime` crate can associate a borrow checker with a memory for the memory's entire lifetime. Wasmtime would then be responsible for checking that the borrow checker has no outstanding borrows whenever an instance which has access to that memory is called.
Ideally, the wasmtime borrow checker would be represented as a trait object, so that we can keep the definition of the borrow checker in the wiggle crate (where it is also used in Lucet), and not require wasmtime users to depend on wiggle nor wiggle users to depend on wasmtime.
Contributor guide
Assessment
This issue has not been assessed yet.