Stream: git-wasmtime

Topic: wasmtime / issue #4240 shared memory: no way to report me...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 07 2022 at 18:02):

abrown opened issue #4240:

In certain cases, a shared memory will not have an associated store. A ResourceLimiter is attached to a store to not only constrain the resources use but also accept certain error scenarios, e.g., when a memory growth operation fails. If memory growth fails for a shared memory, some code should handle the error but as of #4187 there is no mechanism to do so.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 08 2022 at 17:14):

alexcrichton labeled issue #4240:

In certain cases, a shared memory will not have an associated store. A ResourceLimiter is attached to a store to not only constrain the resources use but also accept certain error scenarios, e.g., when a memory growth operation fails. If memory growth fails for a shared memory, some code should handle the error but as of #4187 there is no mechanism to do so.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2022 at 19:23):

abrown commented on issue #4240:

@alexcrichton, should the resolution of this just be to return an error if no Store (and thus ResourceLimiter) are available? E.g.:

if let Some(store) = store {
  store.memory_grow_failed(&format_err!("Memory maximum size exceeded"));
} else {
  bail!("Memory maximum size exceeded");
}

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2022 at 19:24):

abrown edited a comment on issue #4240:

@alexcrichton, should the resolution of this just be to return an error if no Store (and thus ResourceLimiter) are available? E.g.:

if new_byte_size > max {
  if let Some(store) = store {
    store.memory_grow_failed(&format_err!("Memory maximum size exceeded"));
  } else {
    bail!("Memory maximum size exceeded");
  }
  return Ok(None);
}

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2022 at 20:36):

alexcrichton commented on issue #4240:

I don't think so because that would translate to a trap rather than a -1 return value from memory.grow. Additionally the more worrisome case for me is this one where there's no embedder-defined way to limit the growth of a shared memory like there is a way to limit the growth of a non-shared memory.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2022 at 21:02):

abrown commented on issue #4240:

Hm. I had originally thought that a) the ResourceLimiter would have to be disconnected from a Store or b) the shared memory would have to be associated with a store--neither of these seems great... or easy. What do you think?

view this post on Zulip Wasmtime GitHub notifications bot (Jul 01 2022 at 15:48):

alexcrichton commented on issue #4240:

I don't personally know how best to solve this, and I suspect that reusing what we have today probably won't cut it and this'll need some sort of new abstraction or something like that.


Last updated: Dec 23 2024 at 12:05 UTC