Stream: wasmtime

Topic: Cursed Introspection of an Instance


view this post on Zulip Lachlan Sneff (Dec 04 2020 at 04:08):

Hi there,

I'm trying to do something rather cursed and it revolves around being able to save and reload the state of a wasm module. Thankfully, the module will be completely off the stack, so saving the callstack isn't necessary, but it does seem to require getting access to mutable globals and other internal state of the wasm instance that isn't exported. I don't believe wasmtime provides a way of probing instances in ways that their contracts shouldn't allow. Is there a way around this without forking?

view this post on Zulip Alex Crichton (Dec 04 2020 at 05:58):

Wasmtime doesn't have APIs for this at this time, but tools like not useful private url are aimed at assisting this

view this post on Zulip Alex Crichton (Dec 04 2020 at 05:58):

the idea being that the wasm module is massaged into something that can be introspected after-the-fact

view this post on Zulip Alex Crichton (Dec 04 2020 at 06:03):

oh oops sorry that's still a work in progress, disregard me...

view this post on Zulip Lachlan Sneff (Dec 04 2020 at 06:46):

Thanks for the reply! Yeah, I decided to just use walrus and modify the wasm module as necessary to make it possible to do this. And, it works!

view this post on Zulip fitzgen (he/him) (Dec 21 2020 at 19:17):

@Lachlan Sneff FYI the repo Alex linked before is public now: https://github.com/bytecodealliance/wizer

The WebAssembly Pre-Initializer. Contribute to bytecodealliance/wizer development by creating an account on GitHub.

Last updated: Nov 22 2024 at 16:03 UTC