8000 wasi: avoid hard crash if start() is never called by cjihrig · Pull Request #33184 · nodejs/node · GitHub 8000
[go: up one dir, main page]

Skip to content

Conversation

@cjihrig
Copy link
Contributor
@cjihrig cjihrig commented May 1, 2020

Prior to this commit, calling the WebAssembly instance's _start()
export directly would hard crash the process because the memory
was never configured. This commit adds an additional check that
the memory is usable. With this commit, calling _start() directly
will still lead to WASI exiting with a non-zero exit code, but
Node does not crash.

Fixes: #33175

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Prior to this commit, calling the WebAssembly instance's _start()
export directly would hard crash the process because the memory
was never configured. This commit adds an additional check that
the memory is usable. With this commit, calling _start() directly
will still lead to WASI exiting with a non-zero exit code, but
Node does not crash.
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. wasi Issues and PRs related to the WebAssembly System Interface. labels May 1, 2020
@nodejs-github-bot
Copy link
Collaborator
nodejs-github-bot commented May 1, 2020 < 8000 span class="d-inline-block color-fg-muted">•

@cjihrig cjihrig added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 1, 2020
@tniessen
Copy link
Member
tniessen commented May 4, 2020

I didn't see this PR (or the issue) before opening #33235. Please consider it as an alternative:

  • Personally, I think a non-recoverable error (at least not recoverable from WASM) is more appropriate in case a WASI module was not started properly. With this PR, it is up to the WASM module to handle the error code EINVAL, even though the WASM module likely isn't at fault.
  • This PR doesn't prevent calling syscalls that don't access memory.

@cjihrig
Copy link
Contributor Author
cjihrig commented May 4, 2020

I'm good with the approach in #33235. I'll close this.

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

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. wasi Issues and PRs related to the WebAssembly System Interface.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Segfault on combo of global ctors, ostream, wasi

9 participants

0