cfallin commented on issue #3780:
(on posting, I see fitzgen beat me to it -- strong +1 then to multiple-instantiate!)
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:
- fitzgen: fuzzing
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
peterhuene commented on issue #3780:
I'll add a fuzz target for multi-instantiation.
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.
peterhuene commented on issue #3780:
I've added a
poolingfuzz 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.
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 "
Arbitrarylist 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
Arbitraryof aVec<Command>and stream through the events. (With the above I'm imaginingfreelist_indexandinstantiated_list_indexare taken modulo the length of the respective list, then we canswap_removeand put it on the other list; a lot like the drop approach in your current implementation.) Thoughts?
fitzgen commented on issue #3780:
What about the "
Arbitrarylist 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
Arbitraryof aVec<Command>and stream through the events. (With the above I'm imaginingfreelist_indexandinstantiated_list_indexare taken modulo the length of the respective list, then we canswap_removeand 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 :) )
peterhuene commented on issue #3780:
@cfallin I replaced the
poolingfuzz target withinstantiate-manythat 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.
peterhuene commented on issue #3780:
I'll rebase this in a sec.
peterhuene deleted a comment on issue #3780:
I'll rebase this in a sec.
Last updated: Dec 13 2025 at 19:03 UTC