Stream: git-wasmtime

Topic: wasmtime / PR #15050 [48.0.x] Use one alias region per ru...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 28 2026 at 19:31):

vuldin opened PR #15050 from vuldin:release-48-runtime-data-alias-region to bytecodealliance:release-48.0.0:

Hi! We're moving Redpanda's data transforms onto the 48 LTS line, and on 48.0.7 compiling a typical Go guest panics:

called `Result::unwrap()` on an `Err` value: MemFlagsSetOverflow

from inst_builder.rs (load), inside Module::new. We embed Wasmtime through the C API, so that panic can't unwind and aborts the host process.

With copy-on-write memory init off (we have to run with memory_init_cow(false) because guest memory comes from our own allocator), the module startup function initializes every data segment, and for each one it loads the segment's base and length out of the VMContext. vmctx_load/vmctx_store key the alias region on the VMContext offset, so every segment adds two distinct regions, and so two distinct MemFlags, to that one function. Past ~32k data segments that's more than the u16 MemFlags index allows. Go guests routinely have that many (the two that hit it for us have ~43K and ~46K data segments).

This PR keys the region for the runtime_data_bases and runtime_data_lengths arrays on the start of each array instead of on each element. It's only ever coarser than before, and those three helpers are the only accessors of the two arrays, so nothing else touches the same memory under a different region.

On main this is already covered by #14253 (bounding alias regions to 256), which went into 49. That one depends on #14230 and is a much bigger change, so this is a narrower fix for the 48 branch. Another option is to backport #14253 + #14230 instead if you'd rather keep 48 closer to main.

The test compiles and instantiates a module with 40K data segments and memory_init_cow(false). I haven't run Wasmtime's own test suite locally. In Redpanda the same change, applied to 48.0.7, takes our two Go-guest tests from aborting on every run to passing.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 28 2026 at 19:31):

vuldin requested fitzgen for a review on PR #15050.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 28 2026 at 19:31):

vuldin removed the review request for wasmtime-compiler-reviewers from PR #15050.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 28 2026 at 19:31):

vuldin requested wasmtime-compiler-reviewers for a review on PR #15050.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 28 2026 at 19:31):

vuldin requested wasmtime-core-reviewers for a review on PR #15050.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 28 2026 at 20:05):

vuldin updated PR #15050.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 28 2026 at 22:28):

:thumbs_up: fitzgen submitted PR review:

Makes sense, thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 28 2026 at 22:28):

:check: fitzgen merged PR #15050.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 28 2026 at 22:33):

fitzgen commented on PR #15050:

@vuldin could you also send a PR adding release notes to the release-48.0.0 branch's RELEASES.md for this change? Thanks!


Last updated: Oct 31 2026 at 23:03 UTC