Stream: git-wasmtime

Topic: wasmtime / PR #15183 Add memory range APIs, and borrow gu...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 16:58):

cfallin requested wasmtime-core-reviewers for a review on PR #15183.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 16:58):

cfallin requested fitzgen for a review on PR #15183.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 16:58):

cfallin opened PR #15183 from cfallin:memory-range-api to bytecodealliance:main:

In order to support record/replay, we need precise information about when memory is mutated (so we can capture memory side-effects properly). Wasmtime's current APIs provide slices (immutable or mutable) over an entire memory, and the canonical idiom is then to subslice them further; something like memory.data_mut(&mut store)[start..end]. We can support R/R with this but it ain't gonna be efficient: we'd have to capture the whole memory because we don't know about the subsequent sub-slice.

This PR adds Memory::data_range and Memory::data_range_mut to borrow only one range of a memory (and an API alongside Memory::data_and_store_mut as well, with a bit more fiddly detail involving a MemoryRanges struct that represents the memory capability without requiring a full reborrow/rederivation of the borrowed T as well).

This PR also updates both the component-model canonical ABI implementation, and Wiggle, to use this more precise API, so when we eventually implement R/R, we will have precise/small/efficient traces for all of WASIp{1,2,3} programs.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.md

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:26):

:thumbs_up: fitzgen submitted PR review:

r=me w/ comments below addressed

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:26):

:speech_balloon: fitzgen created PR review comment:

Do we really not already have a method to go from &mut Store[Inner]<T> to (&mut T, &mut StoreOpaque)?? That's surprising. Seems worth pulling out into its own method if we really don't.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:26):

:speech_balloon: fitzgen created PR review comment:

And similar here

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:26):

:speech_balloon: fitzgen created PR review comment:

And similar here

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:26):

:speech_balloon: fitzgen created PR review comment:

I think this method is a little misnamed, maybe ranges_and_data_mut or data_ranges_and_store_data_mut? Because we aren't giving back a whole store, just the store's T data. Unfortunate name clobber with "data" being both "memory data" and the "store data" :-/

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:26):

:speech_balloon: fitzgen created PR review comment:

And then similar regarding SliceIndex here

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:26):

:speech_balloon: fitzgen created PR review comment:

Could this instead take a SliceIndex<u8> so that start.., ..end, start..=end, etc... all work with it?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:26):

:speech_balloon: fitzgen created PR review comment:

Can you also add a #[should_panic] test for using a memory from the wrong store? Just because we've had CVEs in the past for forgotten same-store/engine checks, which I don't think this could actually lead to in this case, but best to make sure it is covered.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 21:44):

github-actions[bot] added the label wasi on PR #15183.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 21:44):

github-actions[bot] added the label wasmtime:api on PR #15183.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:18):

:memo: cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:18):

:speech_balloon: cfallin created PR review comment:

Unfortunately this would mean that we don't have the range for later dirty-memory tracking / record-replay -- the SliceIndex trait only lets us apply that abstract index to a slice, not get the start/end indices. (We could derive it by getting raw addresses and doing arithmetic but that seems kind of suboptimal)

I'll leave this as-is on that basis, but happy to refine in followup if you have ideas here!

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:18):

:speech_balloon: cfallin created PR review comment:

(see above)

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:19):

:memo: cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:19):

:memo: cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:19):

:speech_balloon: cfallin created PR review comment:

Renamed! (re: the range vs SliceIndex, see above)

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:21):

cfallin updated PR #15183.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:21):

:memo: cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:21):

:speech_balloon: cfallin created PR review comment:

Added!

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:21):

:memo: cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:21):

:speech_balloon: cfallin created PR review comment:

(see above)

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:25):

cfallin updated PR #15183.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:25):

:memo: cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:25):

:speech_balloon: cfallin created PR review comment:

Done!

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:26):

cfallin has enabled auto merge for PR #15183.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 22:36):

cfallin added PR #15183 Add memory range APIs, and borrow guest memory by range when possible. to the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 23:25):

:check: cfallin merged PR #15183.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 23:25):

cfallin removed PR #15183 Add memory range APIs, and borrow guest memory by range when possible. from the merge queue


Last updated: Nov 19 2026 at 20:05 UTC