WebAssembly / WebAssembly/binaryen

In I64ToI32Lowering pass, lowerReinterpretFloat64() and lowerReinterpretInt64() are not multithreading, ASAN, STACK_OVERLOW_CHECK or SAFE_HEAP safe

Open
#4,710 0 comments 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

In https://github.com/WebAssembly/binaryen/blob/fc00dcc64c337a8128fbf2b5fbdb40bb0aaa861b/src/passes/I64ToI32Lowering.cpp#L548-L584

there are assumptions made that are unsafe for multithreaded Wasm2JS builds. The memory address zero could be trashed by other threads when they are reinterpreted as float64/int64.

Also the Emscripten STACK_OVERFLOW_CHECK, ASAN and SAFE_HEAP checks place a cookie at address 0.

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 in src/passes/I64ToI32Lowering.cpp around lowerReinterpretFloat64() and lowerReinterpretInt64() at the referenced lines. Trace how the pass handles memory address zero and consider the multithreading, ASAN, STACK_OVERFLOW_CHECK, and SAFE_HEAP assumptions; the work is done when those lowerings are safe in the affected Wasm2JS builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.