@Dan Gohman did you want to yourself review https://github.com/bytecodealliance/wasmtime/pull/1290? I'm curious to tweak the APIs a bit more and it'd be building on top of that work so was pondering who to poke for a review
@Alex Crichton I haven't yet decided what I think about this. Using the caller vmctx is cleaner than the mechanism we had before, but as we add more support for controlling how imports and exports are resolved at link time, this will be a kind of back door around that, allowing a process to access exports that haven't been linked with its imports.
@Dan Gohman it's true yeah, but we need something today for wasi at the very least
and it's not like this is set in stone forever, we can always remove it
I also personally feel that if the host can subvert things that's ok
the host is the host after all
I guess that's true.
I'm trying to minimize differences between host modules and wasm modules in my mental model, because we want them to be interchangeable.
But, wasi does need this special power, as will other wasi-like modules
At least, until interface types gives us a better way to pass views of memory around.
that's basically my thinking yeah
we want to erase this, but... we sort of can't right now
and we may as well make it convenient b/c it's gonna be mega-common
How crazy would it be to say you can't use Caller
on a module that uses interface types?
I.e., dynamically enforce that, and document it that way.
I'm not sure if that's the right answer, but I'm thinking about ways we can avoid mega-common + convenient = too widely used to be removed
Lol, I was just thinking "what if we restricted it to just memory exports", and then read the code for get_export
, and that's exactly what it does :-)
@Alex Crichton Ok, I convinced myself that we don't need to add arbitrary restrictions like that. When interface types are ready, we'll just have toolchains use them, and have them stop exporting "memory" by default as they do now, and that will steer people in the right direction.
@Dan Gohman oh sorry was in a mtg
but yeah I think we could easily make get_export
return None
if it's an interface types module
but if it only works on exports the toolchains could also fix it with no exports
Last updated: Nov 22 2024 at 17:03 UTC