Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebAssembly instantiation fails on latest nightly #12740

Closed
RReverser opened this issue Apr 29, 2017 · 15 comments
Closed

WebAssembly instantiation fails on latest nightly #12740

RReverser opened this issue Apr 29, 2017 · 15 comments
Labels
v8 engine Issues and PRs related to the V8 dependency.

Comments

@RReverser
Copy link
Member

RReverser commented Apr 29, 2017

  • Version: v8.0.0-nightly20170428b2c7a51dd7
  • Platform: Darwin Ingvars-MacBook-Pro.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
  • Subsystem: V8

Steps to reproduce:

$ node
> w = fs.readFileSync('hello-world.wasm')
<Buffer 00 61 73 6d 01 00 00 00 00 0c 06 64 79 6c 69 6e 6b 80 80 c0 02 00 01 89 80 80 80 00 02 60 01 7f 01 7f 60 00 00 02 c1 80 80 80 00 04 03 65 6e 76 0a 6d ... >
> new WebAssembly.Module(w)
fish: 'node' terminated by signal SIGILL (Illegal instruction)

I've tried nightly because currently stable Node.js 7.9.0 exposes slightly outdated WebAssembly version even with --expose-wasm.

However, while the nightly one provides up-to-date WebAssembly APIs, it looks like the V8 version it's using is still slightly outdated - 5.7.492.69, so, perhaps it's a known issue that was already fixed on V8 side and just needs to be picked up?

LLDB backtrace

Process 849 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x000000010095ff45 node`v8::internal::WasmModuleObject::New(v8::internal::Isolate*, v8::internal::Handle) + 85
node`v8::internal::WasmModuleObject::New:
->  0x10095ff45 <+85>: ud2
    0x10095ff47 <+87>: movq   %r14, %rsi
    0x10095ff4a <+90>: callq  0x10058e150               ; v8::internal::CanonicalHandleScope::Lookup(v8::internal::Object*)
    0x10095ff4f <+95>: movq   (%rax), %rax
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x000000010095ff45 node`v8::internal::WasmModuleObject::New(v8::internal::Isolate*, v8::internal::Handle) + 85
    frame #1: 0x0000000100944406 node`v8::internal::wasm::CreateModuleObjectFromBytes(v8::internal::Isolate*, unsigned char const*, unsigned char const*, v8::internal::wasm::ErrorThrower*, v8::internal::wasm::ModuleOrigin, v8::internal::Handle, v8::internal::Vector) + 502
    frame #2: 0x000000010093f6d0 node`v8::(anonymous namespace)::WebAssemblyModule(v8::FunctionCallbackInfo const&) + 288
    frame #3: 0x0000000100179962 node`v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo const&)) + 466
    frame #4: 0x00000001001e52e2 node`v8::internal::MaybeHandle v8::internal::(anonymous namespace)::HandleApiCallHelper(v8::internal::Isolate*, v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::BuiltinArguments) + 610
    frame #5: 0x00000001001e4cb8 node`v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) + 232
    frame #6: 0x0000207e80a04427
    frame #7: 0x0000207e80a9eb67
    frame #8: 0x0000207e80b8a825
    frame #9: 0x0000207e80aa0a83
    frame #10: 0x0000207e80a2db61
    frame #11: 0x000000010054b6fc node`v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, bool, v8::internal::Handle, v8::internal::Handle, int, v8::internal::Handle*, v8::internal::Handle, v8::internal::Execution::MessageHandling) + 732
    frame #12: 0x000000010054b363 node`v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle, v8::internal::Handle, int, v8::internal::Handle*) + 179
    frame #13: 0x000000010014d1b0 node`v8::Script::Run(v8::Local) + 640
    frame #14: 0x0000000100ad034f node`node::(anonymous namespace)::ContextifyScript::EvalMachine(node::Environment*, long long, bool, bool, v8::FunctionCallbackInfo const&, v8::TryCatch*) + 449
    frame #15: 0x0000000100acfafe node`node::(anonymous namespace)::ContextifyScript::RunInThisContext(v8::FunctionCallbackInfo const&) + 268
    frame #16: 0x0000000100179962 node`v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo const&)) + 466
    frame #17: 0x00000001001e57af node`v8::internal::MaybeHandle v8::internal::(anonymous namespace)::HandleApiCallHelper(v8::internal::Isolate*, v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::BuiltinArguments) + 911
    frame #18: 0x00000001001e4ce9 node`v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) + 281
    frame #19: 0x0000207e80a04427
    frame #20: 0x0000207e80b32733
    frame #21: 0x0000207e80ac676e
    frame #22: 0x0000207e80aa19fd
    frame #23: 0x0000207e80b79271
    frame #24: 0x0000207e80b79023
    frame #25: 0x0000207e80a05f15
    frame #26: 0x0000207e80b78dcf
    frame #27: 0x0000207e80b6ed24
    frame #28: 0x0000207e80b20fa0
    frame #29: 0x0000207e80a05f15
    frame #30: 0x0000207e80b780c0
    frame #31: 0x0000207e80b771e4
    frame #32: 0x0000207e80b730bf
    frame #33: 0x0000207e80b70da8
    frame #34: 0x0000207e80b70a32
    frame #35: 0x0000207e80b21508
    frame #36: 0x0000207e80b21025
    frame #37: 0x0000207e80a05f15
    frame #38: 0x0000207e80ad872e
    frame #39: 0x0000207e80aa19fd
    frame #40: 0x0000207e80a4cd2d
    frame #41: 0x0000207e80ac676e
    frame #42: 0x0000207e80aa19fd
    frame #43: 0x0000207e80b6ec45
    frame #44: 0x0000207e80b20fa0
    frame #45: 0x0000207e80a05f15
    frame #46: 0x0000207e80b6e59b
    frame #47: 0x0000207e80b6de06
    frame #48: 0x0000207e80a05f15
    frame #49: 0x0000207e80b6d307
    frame #50: 0x0000207e80a05f15
    frame #51: 0x0000207e80aa0a83
    frame #52: 0x0000207e80a2db61
    frame #53: 0x000000010054b6fc node`v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, bool, v8::internal::Handle, v8::internal::Handle, int, v8::internal::Handle*, v8::internal::Handle, v8::internal::Execution::MessageHandling) + 732
    frame #54: 0x000000010054b363 node`v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle, v8::internal::Handle, int, v8::internal::Handle*) + 179
    frame #55: 0x000000010016209f node`v8::Function::Call(v8::Local, v8::Local, int, v8::Local*) + 559
    frame #56: 0x0000000100a9c1ce node`node::AsyncWrap::MakeCallback(v8::Local, int, v8::Local*) + 600
    frame #57: 0x0000000100af6a41 node`node::StreamBase::EmitData(long, v8::Local, v8::Local) + 223
    frame #58: 0x0000000100af8e64 node`node::StreamWrap::OnReadImpl(long, uv_buf_t const*, uv_handle_type, void*) + 524
    frame #59: 0x0000000100af937d node`node::StreamWrap::OnReadCommon(uv_stream_s*, long, uv_buf_t const*, uv_handle_type) + 127
    frame #60: 0x0000000100c11d94 node`uv__stream_io + 1261
    frame #61: 0x0000000100c195b1 node`uv__io_poll + 1621
    frame #62: 0x0000000100c0a43b node`uv_run + 321
    frame #63: 0x0000000100ab6999 node`node::Start(v8::Isolate*, node::IsolateData*, int, char const* const*, int, char const* const*) + 514
    frame #64: 0x0000000100ab65d4 node`node::Start(uv_loop_s*, int, char const* const*, int, char const* const*) + 447
    frame #65: 0x0000000100ab5815 node`node::Start(int, char**) + 329
    frame #66: 0x0000000100001734 node`start + 52

@Fishrock123
Copy link
Contributor

IIRC it was segfaulting for me a couple weeks ago, too.

@RReverser
Copy link
Member Author

Was it segfault or sigill though? But yeah, I've tried few slightly older nightlies, they had this issue too.

@mscdex mscdex added the v8 engine Issues and PRs related to the V8 dependency. label Apr 29, 2017
@mscdex
Copy link
Contributor

mscdex commented Apr 29, 2017

/cc @nodejs/v8

@targos
Copy link
Member

targos commented Apr 29, 2017

We should try with V8 5.8.

@targos
Copy link
Member

targos commented Apr 29, 2017

Can't test myself right now but here is a branch with V8 5.8: https://github.com/targos/node/commits/v8-5.8

@hashseed
Copy link
Member

There is also one with newer V8 here: v8@4f1a48b

@RReverser
Copy link
Member Author

RReverser commented Apr 30, 2017

For now, I've tried prebuilt test binary with V8 5.9 from https://nodejs.org/download/test/v8.0.0-test201704119b43f9c487/ (source: nodejs/CTC#99) and that one works correctly. So the fix was somewhere in between.

@targos
Copy link
Member

targos commented May 1, 2017

I cannot reproduce on Linux. Tried with master and v8-5.8.

@RReverser
Copy link
Member Author

Ok so it was indeed fixed between 5.7.492.69 and 5.8... Is the plan to update to 5.8 soon or better to do git bisect and find the actual fix?

@targos
Copy link
Member

targos commented May 1, 2017

The plan is to update to 5.8 before we release 8.0.0 so I don't think we need to find the fix.

@RReverser
Copy link
Member Author

I see. Hoped to play with Emscripten-generated WebAssembly, and only nightly Node has up-to-date API for that, but if it will be updated soon, that can wait.

@RReverser
Copy link
Member Author

Should I close this issue or keep as a tracking issue that others can find until V8 is updated?

@gibfahn
Copy link
Member

gibfahn commented May 2, 2017

This should be fixed by #12784, probably worth leaving this open so you can verify that Node.js works once that lands.

@RReverser RReverser mentioned this issue May 2, 2017
2 tasks
@targos
Copy link
Member

targos commented May 12, 2017

V8 5.8 landed on master

@targos targos closed this as completed May 12, 2017
@RReverser
Copy link
Member Author

Confirmed, seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

6 participants