Stream: git-wasmtime

Topic: wasmtime / issue #6668 Question: Why does `ResourceLimite...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2023 at 09:50):

Robbepop opened issue #6668:

As can be seen in the docs (https://docs.rs/wasmtime/10.0.1/wasmtime/trait.ResourceLimiter.html) the ResourceLimiter provides limits for Instance, Memory and Table instance counts but not for Global and Func.

This question came up in https://github.com/paritytech/wasmi/pull/737 and we were wondering about the rationals behind this design.

Clarifications would be very welcome. :)

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2023 at 09:50):

Robbepop edited issue #6668:

As can be seen in the docs (https://docs.rs/wasmtime/10.0.1/wasmtime/trait.ResourceLimiter.html) the ResourceLimiter provides limits for Instance, Memory and Table instance counts but not for Global and Func.

This question came up in https://github.com/paritytech/wasmi/pull/737 and we were wondering about the rationals behind this design.

Clarifications would be very welcome. :)

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2023 at 15:09):

alexcrichton commented on issue #6668:

I don't think there's a main principle behind this per se, but I can attempt to retcon it a bit by saying that one difference between memories/tables vs funcs/globals is that the former have runtime lengths associated with them where the latter have a static size which doesn't change. Not to say functions/globals couldn't be limited, however.

In Wasmtime at least the number of functions/globals factors into the size of a VMContext which is where limits would be placed, but the limit there is somewhat abstract where you'd say, for example, "instances should get at most 1MB of state" but what exactly is in that 1MB is up to Wasmtime (but globals/funcs fit in there and factor into that)

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2023 at 16:29):

Robbepop commented on issue #6668:

Thank you a lot for providing me with the rationals behind the design @alexcrichton !

Given that Wasmtime has a multitude of users compared to wasmi I was wondering why this was not asked before by users. At least for embedded systems were wasmi is used primarily I see a potential for users who want to limit globals and funcs as well. However, at the same time wasmi tries at best effort to stay as close to the Wasmtime API as possible for the benefit of all users only having to learn a single, reasonable API.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2023 at 16:30):

Robbepop edited a comment on issue #6668:

Thank you a lot for providing me with the rationals behind the design @alexcrichton !

Given that Wasmtime has a multitude of users compared to wasmi I was wondering why this was not asked before by users. At least for embedded systems were wasmi is used primarily I see a potential for users who want to limit globals and funcs as well. However, at the same time wasmi tries at best effort to stay as close to the Wasmtime API as possible for the benefit of all users only having to learn a single, reasonable API.

I guess this issue can be closed. If people actually need this they can open another issue with the request.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2023 at 16:31):

Robbepop edited a comment on issue #6668:

Thank you a lot for providing me with the rationals behind the design @alexcrichton !

Given that Wasmtime has a multitude of users compared to wasmi I was wondering why this was not asked before by users. At least for embedded systems were wasmi is used primarily I see a potential for users who want to limit globals and funcs as well. However, at the same time wasmi tries its best to stay as close to the Wasmtime API as possible for the benefit of all users only having to learn a single, reasonable API.

I guess this issue can be closed. If people actually need this they can open another issue with the request.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2023 at 17:11):

alexcrichton commented on issue #6668:

Ok, sounds reasonable!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2023 at 17:11):

alexcrichton closed issue #6668:

As can be seen in the docs (https://docs.rs/wasmtime/10.0.1/wasmtime/trait.ResourceLimiter.html) the ResourceLimiter provides limits for Instance, Memory and Table instance counts but not for Global and Func.

This question came up in https://github.com/paritytech/wasmi/pull/737 and we were wondering about the rationals behind this design.

Clarifications would be very welcome. :)


Last updated: Oct 23 2024 at 20:03 UTC