Stream: git-wasmtime

Topic: wasmtime / PR #4825 components: Limit the recursive size ...


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

alexcrichton opened PR #4825 from limit-component-recursion to main:

This commit is aimed at fixing #4814 by placing a hard limit on the
maximal recursive depth a type may have in the component model. The
component model theoretically allows for infinite recursion but many
various types of operations within the component model are naturally
written as recursion over the structure of a type which can lead to
stack overflow with deeply recursive types. Some examples of recursive
operations are:

By placing a hard limit on type recursion Wasmtime won't be able to load
some otherwise-valid modules. The hope, though, is that no human-written
program is likely to ever reach this limit. This limit can be revised
and/or the locations with recursion revised if it's ever reached.

The implementation of this feature is done by generalizing the current
flattened-representation calculation which now keeps track of a type's
depth and size. The size calculation isn't used just yet but I plan to
use it in fixing #4816 and it was natural enough to write here as well.
The depth is checked after a type is translated and if it exceeds the
maximum then an error is returned.

Additionally the Arbitrary for Type implementation was updated to
prevent generation of a type that's too-recursive.

Closes #4814

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

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

alexcrichton requested fitzgen for a review on PR #4825.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 15:18):

alexcrichton updated PR #4825 from limit-component-recursion to main.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 16:46):

fitzgen created PR review comment:

Why not 99?

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 16:46):

fitzgen created PR review comment:

todo

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 16:46):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 16:46):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 16:51):

alexcrichton updated PR #4825 from limit-component-recursion to main.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 16:51):

alexcrichton created PR review comment:

Oops this was actually intended for a separate PR so I'm going to remove this

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 16:51):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 16:53):

alexcrichton updated PR #4825 from limit-component-recursion to main.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 16:53):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 16:53):

alexcrichton created PR review comment:

Originally I didn't really want to deal with off-by-one bugs with these sorts of arbitrary limits, but I suppose there's no harm in fixing them if they come up.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 16:53):

alexcrichton has enabled auto merge for PR #4825.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 17:11):

alexcrichton updated PR #4825 from limit-component-recursion to main.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2022 at 18:29):

alexcrichton merged PR #4825.


Last updated: Nov 22 2024 at 17:03 UTC