Skip to content

Fix(wasi): enable configurable stack overflow protection - #1700

Open
aayush-kapoor wants to merge 1 commit into
quickjs-ng:masterfrom
aayush-kapoor:aayush/0
Open

Fix(wasi): enable configurable stack overflow protection#1700
aayush-kapoor wants to merge 1 commit into
quickjs-ng:masterfrom
aayush-kapoor:aayush/0

Conversation

@aayush-kapoor

Copy link
Copy Markdown

What

This PR makes JS_SetMaxStackSize() work on WASI builds.

WASI still defaults to no stack guard, so existing users are unaffected. Embedders can now opt into a limit and receive a catchable JavaScript stack overflow instead of a WASM memory trap.

It also adds WASI tests covering:

  • Catchable recursive stack overflow
  • Runtime usability after the overflow
  • The unchanged default behavior

Why

The Run SDK wants to use quickjs-wasi. the Run SDK currently supports a configurable maxStackSizeBytes limit. That limit currently cannot be enforced because QuickJS ignores JS_SetMaxStackSize() on WASI.

This change unblocks stack-limit support in quickjs-wasi, which can then be used by run

Related run PRs:

@aayush-kapoor

Copy link
Copy Markdown
Author

@bnoordhuis could i please bother you for a review? facing a downstream issue 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant