WebAssembly / WebAssembly/binaryen

StackCheck pass can do that wrong thing when no stack pointer is present

Open
#5,741 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

I notices a strange failure on HEAD with a test that I guess we don't run anywhere: ./test/runner core2ss.test_pthread_dylink_tls .

The problem is with -sSTACK_OVERFLOW_CHECK which runs that StackCheck check pass, which depends on being able to find the stack pointer global (__stack_pointer), but in this case the side module its being run on doesn't contain any stack usage and so it simply doesn't have a __stack_pointer global. The StackCheck pass then assumes that the first imported global is that stack pointer (but in fact its env.__memory_base).. and then it fails the stack check during __wasm_init_memory when it first reads this global.

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 running ./test/runner core2ss.test_pthread_dylink_tls with -sSTACK_OVERFLOW_CHECK and inspect the StackCheck pass behavior for a side module without a __stack_pointer global. Done means the test no longer treats env.__memory_base as the stack pointer and the stack check does not fail during __wasm_init_memory.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.