WebAssembly / WebAssembly/binaryen

[wasm-opt] Global variables are not shared between threads, so using wasm-opt `--multi-memory-lowering` will cause memory corruption.

Open
#7,916 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

Please ignore this comment and read on.
Currently, --multi-memory-lowering seems to handle memory allocation in the Min memory.
However, in practice, it would be more natural if the allocation could adapt to the Max memory size specified for the module.

However, this may become excessively large, so it would be preferable if it could be configurable.
Since this would break compatibility, it would likely require introducing a new command.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the wasm-opt --multi-memory-lowering implementation and how it handles allocation from the module's minimum memory. Clarify the title's thread-sharing and memory-corruption concern, then define how configurable maximum-memory-based allocation and any compatibility-preserving command should behave.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.