Stream: git-wasmtime

Topic: wasmtime / issue #6754 Pointer not aligned to 8


view this post on Zulip Wasmtime GitHub notifications bot (Jul 20 2023 at 11:23):

dbezhetskov added the bug label to Issue #6754.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 20 2023 at 11:23):

dbezhetskov opened issue #6754:

Test Case

I'm experimenting with generating wasm and SpiderMonkey. The test case is a bit hard to reproduce but it is just executing a mix of generated by hand wasm and SpiderMonkey compiled to wasm.

Steps to Reproduce

...

Expected Results

No bug.

Actual Results

wasmtime._error.WasmtimeError: error while executing at wasm backtrace:
0: 0x776866 - <unknown>!__wasi_clock_time_get
1: 0x77667d - <unknown>!__clock_gettime
2: 0x10b26 - <unknown>!mozilla::TimeStamp::Now(bool)
3: 0x466d61 - <unknown>!js::jit::BaselineCacheIRCompiler::compile()
4: 0x46fbc9 - <unknown>!js::jit::AttachBaselineCacheIRStub(JSContext, js::jit::CacheIRWriter const&, js::jit::CacheKind, JSScript, js::jit::ICScript, js::jit::ICFallbackStub, char const*)
5: 0x48bd4d - <unknown>!js::jit::DoSetElemFallback(JSContext, js::jit::BaselineFrame, js::jit::ICFallbackStub, JS::Value, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::Handle<JS::Value>)
6: 0xdbc - <unknown>!<wasm function 11>
7: 0x2674 - <unknown>!<wasm function 37>
8: 0x2022 - <unknown>!<wasm function 33>
9: 0x393 - <unknown>!<wasm function 0>
10: 0x5c315f - <unknown>!js::jit::MaybeEnterJit(JSContext*, js::RunState&)
11: 0x8bfbf - <unknown>!js::RunScript(JSContext*, js::RunState&)
12: 0x9cdc4 - <unknown>!js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason)
13: 0x9d541 - <unknown>!js::CallFromStack(JSContext*, JS::CallArgs const&, js::CallReason)
14: 0x48efd5 - <unknown>!js::jit::DoCallFallback(JSContext, js::jit::BaselineFrame, js::jit::ICFallbackStub, unsigned int, JS::Value, JS::MutableHandle<JS::Value>)
15: 0x86c - <unknown>!<wasm function 5>
16: 0x231d - <unknown>!<wasm function 35>
17: 0x21a6 - <unknown>!<wasm function 34>
18: 0x393 - <unknown>!<wasm function 0>
19: 0x5c315f - <unknown>!js::jit::MaybeEnterJit(JSContext*, js::RunState&)
20: 0x8bfbf - <unknown>!js::RunScript(JSContext*, js::RunState&)
21: 0x9cdc4 - <unknown>!js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason)
22: 0x9d653 - <unknown>!js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason)
23: 0x2875af - <unknown>!JS_CallFunctionName(JSContext, JS::Handle<JSObject>, char const*, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>)
24: 0xdab4 - CallFunctionByName(char*, bool)

Versions and Environment

Wasmtime version or commit: wasmtime-cli 8.0.1

Operating system: Ubuntu

Architecture: amd_x64

Extra Info

My question is - what pointers should I align to be able to call __wasi_clock_time_get? StackPointer?
I export StackPointer from SpiderMonkey instance and use it to allocate stack.
I'm just curious of restrictions that I should to follow.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 20 2023 at 12:50):

alexcrichton commented on issue #6754:

Low level details of WASI APIs such as alignment aren't super well documented for preview1 but it's possible to dig into them if you're interested. In general alignment behaves like C and 64-bit types are 8-byte aligned. You'll likely want to have a reference for the ABI of preview1 on-hand when digging into that.

In the meantime though if you're modifying the stack pointer directly then it seems like one of the more likely causes of this error is that LLVM-generated wasm expects the in-wasm stack pointer to be 16-byte aligned. Are your modifications preserving this alignment or should you perhaps also be adding alignment in?

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2023 at 18:42):

alexcrichton commented on issue #6754:

I'm going to close this since we haven't gotten many more details and the suspicion is that the modifications here are changing the stack pointer, but please feel free to comment with more details and I can reopen and/or help investigate further.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2023 at 18:42):

alexcrichton closed issue #6754:

Test Case

I'm experimenting with generating wasm and SpiderMonkey. The test case is a bit hard to reproduce but it is just executing a mix of generated by hand wasm and SpiderMonkey compiled to wasm.

Steps to Reproduce

...

Expected Results

No bug.

Actual Results

wasmtime._error.WasmtimeError: error while executing at wasm backtrace:
0: 0x776866 - <unknown>!__wasi_clock_time_get
1: 0x77667d - <unknown>!__clock_gettime
2: 0x10b26 - <unknown>!mozilla::TimeStamp::Now(bool)
3: 0x466d61 - <unknown>!js::jit::BaselineCacheIRCompiler::compile()
4: 0x46fbc9 - <unknown>!js::jit::AttachBaselineCacheIRStub(JSContext, js::jit::CacheIRWriter const&, js::jit::CacheKind, JSScript, js::jit::ICScript, js::jit::ICFallbackStub, char const*)
5: 0x48bd4d - <unknown>!js::jit::DoSetElemFallback(JSContext, js::jit::BaselineFrame, js::jit::ICFallbackStub, JS::Value, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::Handle<JS::Value>)
6: 0xdbc - <unknown>!<wasm function 11>
7: 0x2674 - <unknown>!<wasm function 37>
8: 0x2022 - <unknown>!<wasm function 33>
9: 0x393 - <unknown>!<wasm function 0>
10: 0x5c315f - <unknown>!js::jit::MaybeEnterJit(JSContext*, js::RunState&)
11: 0x8bfbf - <unknown>!js::RunScript(JSContext*, js::RunState&)
12: 0x9cdc4 - <unknown>!js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason)
13: 0x9d541 - <unknown>!js::CallFromStack(JSContext*, JS::CallArgs const&, js::CallReason)
14: 0x48efd5 - <unknown>!js::jit::DoCallFallback(JSContext, js::jit::BaselineFrame, js::jit::ICFallbackStub, unsigned int, JS::Value, JS::MutableHandle<JS::Value>)
15: 0x86c - <unknown>!<wasm function 5>
16: 0x231d - <unknown>!<wasm function 35>
17: 0x21a6 - <unknown>!<wasm function 34>
18: 0x393 - <unknown>!<wasm function 0>
19: 0x5c315f - <unknown>!js::jit::MaybeEnterJit(JSContext*, js::RunState&)
20: 0x8bfbf - <unknown>!js::RunScript(JSContext*, js::RunState&)
21: 0x9cdc4 - <unknown>!js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason)
22: 0x9d653 - <unknown>!js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason)
23: 0x2875af - <unknown>!JS_CallFunctionName(JSContext, JS::Handle<JSObject>, char const*, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>)
24: 0xdab4 - CallFunctionByName(char*, bool)

Versions and Environment

Wasmtime version or commit: wasmtime-cli 8.0.1

Operating system: Ubuntu

Architecture: amd_x64

Extra Info

My question is - what pointers should I align to be able to call __wasi_clock_time_get? StackPointer?
I export StackPointer from SpiderMonkey instance and use it to allocate stack.
I'm just curious of restrictions that I should to follow.


Last updated: Nov 22 2024 at 17:03 UTC