Stream: git-wasmtime

Topic: wasmtime / issue #3780 Add the instance allocation strate...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 08 2022 at 22:54):

cfallin commented on issue #3780:

(on posting, I see fitzgen beat me to it -- strong +1 then to multiple-instantiate!)

view this post on Zulip Wasmtime GitHub notifications bot (Feb 08 2022 at 23:01):

github-actions[bot] commented on issue #3780:

Subscribe to Label Action

cc @fitzgen

<details>
This issue or pull request has been labeled: "fuzzing"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Feb 08 2022 at 23:05):

peterhuene commented on issue #3780:

I'll add a fuzz target for multi-instantiation.

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

fitzgen commented on issue #3780:

Thanks! The fuzz target should also drop instances in random orders as well, so that it exercises the pooling allocator free lists too.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2022 at 04:19):

peterhuene commented on issue #3780:

I've added a pooling fuzz target that tests the pooling allocator by allocating instances from different modules and then dropping them in a different order.

Take a look at the last commit and let me know if this approach needs improvement.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2022 at 06:12):

cfallin commented on issue #3780:

This is definitely in the right direction! If I understand correctly, this basically implements a two-phase approach: instantiate many times, picking from a group of modules (possibly instantiating the same module into multiple slots); then terminate all the instances, in some arbitrary order. Is that right?

The thing that I think would be good to add would be reuse of pool slots, from the instantiate->drop->instantiate pattern; in other words, there need to be instantiate and drop events interwoven, rather than in two separate phases, to get some of the interesting corner cases. (With memfd for example it'd be nice to have coverage of cases that instantiate the same module over the same slot.)

What about the "Arbitrary list of commands" fuzzing approach? Something like:

#[derive(Arbitrary)]
enum Command {
  Instantiate { freelist_index: usize, module_id: usize },
  Terminate { instantiated_list_index: usize },
}

then take an Arbitrary of a Vec<Command> and stream through the events. (With the above I'm imagining freelist_index and instantiated_list_index are taken modulo the length of the respective list, then we can swap_remove and put it on the other list; a lot like the drop approach in your current implementation.) Thoughts?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2022 at 17:05):

fitzgen commented on issue #3780:

What about the "Arbitrary list of commands" fuzzing approach? Something like:

#[derive(Arbitrary)] enum Command { Instantiate { freelist_index: usize, module_id: usize }, Terminate { instantiated_list_index: usize }, }

then take an Arbitrary of a Vec<Command> and stream through the events. (With the above I'm imagining freelist_index and instantiated_list_index are taken modulo the length of the respective list, then we can swap_remove and put it on the other list; a lot like the drop approach in your current implementation.) Thoughts?

(+1 but I'm going to bow out from further review here since it seems like we're at risk of too many cooks in the kitchen and y'all have this covered :) )

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2022 at 04:56):

peterhuene commented on issue #3780:

@cfallin I replaced the pooling fuzz target with instantiate-many that tries to instantiate an arbitrary number of times followed by an interleaving of additional instantiations or terminations in an attempt to fuzz the reuse affinity.

Let me know if you think there's more than can be done with this approach.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2022 at 19:03):

peterhuene commented on issue #3780:

I'll rebase this in a sec.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2022 at 19:10):

peterhuene deleted a comment on issue #3780:

I'll rebase this in a sec.


Last updated: Dec 23 2024 at 12:05 UTC