alexcrichton opened PR #3238 from fix-uaf
to main
:
In #3231 the wasm data sections were moved from the
wasmtime_environ::Module
structure into theCompilationArtifacts
.
Eachwasmtime_runtime::Instance
holds raw pointers into the data
section owned by the compilation artifacts under the assumption that the
runtime keeps the artifacts alive while the module is in use. Data is
needed beyond original initialization formemory.init
instructions as
well as lazy-initialization with theuffd
feature.The intention of #3231 was that all
CompiledModule
structures, which
ownCompilationArtifacts
were owned by a store'sModuleRegistry
, so
this was already taken care of. It turns out, however, that empty
modules which contain no functions are not held within a
ModuleRegistry
since there was no need prior to retain them. This
commit remedies this mistake by retaining theCompiledModule
structure, even if there aren't any functions compiled in.This should unblock #3235 and fixes the spurious error found there. The
test here, at least on Linux, will deterministically reproduce the error
before this commit sinceuffd
was initializing wasm memory with free'd
host memory.<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
alexcrichton requested peterhuene for a review on PR #3238.
peterhuene submitted PR review.
alexcrichton merged PR #3238.
Last updated: Dec 23 2024 at 13:07 UTC