bytecodealliance / bytecodealliance/wasmtime
Large bulk operations to not have fuel checks/preemption points in the middle
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 121
Description
For Wasmtime's original 46.0.0 release it originally contained a crop of changes where bulk operations (e.g. `memory.copy`) were updated to chunk the operation internally when fuel/epochs were enabled with preemption checks in the middle. The goal of this translation was to ensure that a very large `memory.copy`, such as moving 2GiB of data, wouldn't represent an uninterrputible chunk of work the guest could perform. This was later discovered to be the source of a number of [possible security vulnerabilities with epoch callbacks](https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-2hw9-mc66-jc2q), and this behavior was reverted in https://github.com/bytecodealliance/wasmtime/pull/14045 to only check for epochs/fuel at the start of an operation instead of during an operation. This results in a doc block on epochs/fuel, however, that large bulk operations represent uninterruptible chunks of work where the only way to limit them is to limit the total size of a linear memory itself.
This isn't a great situation and we should probably somehow figure out how to add preemption checks in the middle. This'll need to be done relatively carefully to avoid reintroducing the problems that were fixed in #14045.
Contributor guide
Assessment
This issue has not been assessed yet.