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: MemFlagsSetOverflowfrom
inst_builder.rs(load), insideModule::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 theVMContext.vmctx_load/vmctx_storekey the alias region on theVMContextoffset, so every segment adds two distinct regions, and so two distinctMemFlags, to that one function. Past ~32k data segments that's more than theu16MemFlagsindex 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_basesandruntime_data_lengthsarrays 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
mainthis 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 tomain.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.
vuldin requested fitzgen for a review on PR #15050.
vuldin removed the review request for wasmtime-compiler-reviewers from PR #15050.
vuldin requested wasmtime-compiler-reviewers for a review on PR #15050.
vuldin requested wasmtime-core-reviewers for a review on PR #15050.
vuldin updated PR #15050.
:thumbs_up: fitzgen submitted PR review:
Makes sense, thanks!
:check: fitzgen merged PR #15050.
fitzgen commented on PR #15050:
@vuldin could you also send a PR adding release notes to the
release-48.0.0branch'sRELEASES.mdfor this change? Thanks!
Last updated: Oct 31 2026 at 23:03 UTC