Stream: git-wasmtime

Topic: wasmtime / issue #400 Stack depth mistracking error


view this post on Zulip Wasmtime GitHub notifications bot (Sep 27 2021 at 17:28):

alexcrichton commented on issue #400:

Lightbeam was removed in https://github.com/bytecodealliance/wasmtime/pull/3390 as explained in RFC 14, so I'm going to close this.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 27 2021 at 17:28):

alexcrichton closed issue #400:

So for months now we've had a miscompilation that is preventing us from integrating Lightbeam into Substrate. What we know about what causes the bug:

The bug itself appears to be that something (unknown what) causes the stack pointer differential (i.e. the difference between the stack pointer and the stack pointer that the function started with) tracked by the backend to be misaligned with the actual stack pointer differential, so when we try to emit an instruction to put the stack pointer back to where it should be for the ret instruction we add the wrong amount to the pointer and ret jumps to a garbage location, which appears to currently always be 0x10. As far as I know, 0x10 isn't special, it's just that the function just happens to always have that on the stack because the compilation and execution is deterministic on a per-function basis. It's not clear what function is actually causing this, I'm looking into getting wasmi or another interpreter to print out a call tree during execution (far better than a statically-generated calltree because of the kooky semantics of call_indirect) so that we can do a kind of binary search using wasm-snip or a similar tool. Alternatively, we can just implement emitting debuginfo in Lightbeam so that rr can print a backtrace. The latter is probably more work, but it's something we should do anyway. Once we have it down to a single function we might be able to get a better idea of what is causing this.

My guess is that it's related to one of the following:


Last updated: Nov 22 2024 at 16:03 UTC