alexcrichton requested dicej for a review on PR #11460.
alexcrichton opened PR #11460 from alexcrichton:memory-growth-async to bytecodealliance:main:
This is an analog of https://github.com/bytecodealliance/wasmtime/pull/11442 but for memories. This had a little more
impact due to memories being hooked into GC operations. Further
refactoring of GC operations to make them safer/more-async is deferred
to a future PR and for now it's "no worse than before". This is another
step towards https://github.com/bytecodealliance/wasmtime/pull/11430 and enables removing a longstandingunsafeblock
inruntime/memory.rswhich previously could not be removed.One semantic change from this is that growth of a shared memory no
longer uses an async limiter. This is done to keep growth of a shared
memory consistent with creation of a shared memory where no limits are
applied. This is due to the cross-store nature of shared memories which
means that we can't tie growth to any one particular store. This
additionally fixes an issue where an rwlock write guard was otherwise
held across a.awaitpoint which creates a non-Sendfuture, closing
a possible soundness hole in Wasmtime.
alexcrichton requested wasmtime-core-reviewers for a review on PR #11460.
alexcrichton commented on PR #11460:
Note that the first commit here is from https://github.com/bytecodealliance/wasmtime/pull/11459
alexcrichton updated PR #11460.
fitzgen commented on PR #11460:
One semantic change from this is that growth of a shared memory no
longer uses an async limiter. This is done to keep growth of a shared
memory consistent with creation of a shared memory where no limits are
applied. This is due to the cross-store nature of shared memories which
means that we can't tie growth to any one particular store.Seems like we should call the async limiter of the store that is doing the growth, that way an embedder could still guarantee that all growth is limited from a holistic system point of view, even if one particular store's limiter doesn't handle all the grow calls.
Mind filing a follow up issue for this?
alexcrichton commented on PR #11460:
That's theoretically possible yeah but it's already preexisting that the resource limiter isn't used when a
SharedMemoryis created through the embedder API. There's also still the issue that the rwlock write guard can't be held across an await point which would be a much more invasive change.I've added a note to https://github.com/bytecodealliance/wasmtime/issues/4245 to accompany similar issues in https://github.com/bytecodealliance/wasmtime/issues/4240 and https://github.com/bytecodealliance/wasmtime/issues/4244
fitzgen submitted PR review.
fitzgen created PR review comment:
Mind adding a safety comment while you're here?
alexcrichton updated PR #11460.
alexcrichton has enabled auto merge for PR #11460.
alexcrichton has disabled auto merge for PR #11460.
alexcrichton merged PR #11460.
Last updated: Dec 06 2025 at 07:03 UTC