Stream: git-wasmtime

Topic: wasmtime / PR #10924 Add intial porting of table_ops from...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2025 at 19:38):

khagankhan opened PR #10924 from khagankhan:initial-mutatis to bytecodealliance:main:

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

This is the initial porting of table_ops from arbitrary to mutatis.

No new features are added. This is a direct port of the existing implementation using the arbitrary crate to the mutatis framework.

Open to review and feedback.

Initial work towards: bytecodealliance/wasmtime#10327
cc @ospencer @fitzgen

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2025 at 19:38):

khagankhan requested alexcrichton for a review on PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2025 at 19:38):

khagankhan requested wasmtime-fuzz-reviewers for a review on PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2025 at 19:42):

khagankhan edited PR #10924:

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

This is the initial (unofficial) porting of table_ops from arbitrary to mutatis.

No new features are added. This is a direct port of the existing implementation using the arbitrary crate to the mutatis framework.

Open to review and feedback.

Initial work towards: bytecodealliance/wasmtime#10327
cc @ospencer @fitzgen

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2025 at 20:04):

fitzgen requested fitzgen for a review on PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2025 at 22:44):

github-actions[bot] commented on PR #10924:

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 (Jun 05 2025 at 22:53):

khagankhan updated PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 17:02):

khagankhan updated PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen submitted PR review:

This is on the right track!

You can rebase on main to get the cargo vet audits for mutatis so that that part of CI stops failing.

Also make sure to check that the actual fuzz target that runs this stuff continues to build via

$ cargo fuzz check --no-default-features -s none misc

You probably need to fix some stuff up in there and maybe hook up a custom mutator for libfuzzer, as described here: https://docs.rs/mutatis/latest/mutatis/_guide/fuzzer_integration/index.html

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

I think we won't need this helper anymore, given the fixup helper function I suggested in private communication.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

Similarly, I think this function body will get cleaned up a ton with the fixup pass. Additionally, whenever possible we don't want to report mutations that we know will fail so if the ops are empty we shouldn't call c.mutation(...). Putting these things together, I expect this will become something like:

if !ops.ops.is_empty() {
    c.mutation(|ctx| {
        let i = ctx.rng().gen_index(ops.ops.len()).unwrap();
        ops.ops[i] = choose_random_op();
        Ok(())
    })?;
}

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

And this can become an arbitrary insert instead of append (which is a subset of an insert operation).

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

And rather than generating the max every time, it probably makes sense to do something like

for _ in ctx.rng().gen_index(MAX_OPS).unwrap() {
   // ...
}

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

And this can be TableOps::default() where the default is an empty set of ops, since we will generate new ops just below. There is no need to start with this prologue every time.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

And this can become something like

if !ops.ops.is_empty() {
    c.mutation(|ctx| {
        let i = ctx.rng().gen_index(ops.ops.len()).unwrap();
        ops.ops.remove(i);
        Ok(())
    })?;
}

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

This is accidentally O(n*n) because the helper walks every op in every iteration of this loop. You'll want to have a local stack variable that is adjusted as ops are generated here.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

Here we would add Default next to Debug.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

This macro should just be TableOps::default(), which can simply be derived on the type rather than written out.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

Don't think this needs to be pub because I don't think it is used outside this module.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

Ditto.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

I don't think we should need this, and can simply use an empty TableOps::default() instead, but if we did want to create this particular sequence in a bunch of places we should just use a function rather than a macro.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

And the insert mutation would be something like

c.mutation(|ctx| {
    let i = ctx.rng().gen_index(ops.ops.len() + 1).unwrap();
    ops.ops.insert(random_op());
    Ok(())
})?;

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

Because the TableOpsMutator is the default, we don't actually need this test; it is redundant with mutate_table_ops_with_default_mutator.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:31):

fitzgen created PR review comment:

Reminder for this TODO.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:38):

khagankhan submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:38):

khagankhan created PR review comment:

Yes! I am working on that and a fixup method results in much cleaner code.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:38):

khagankhan submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:38):

khagankhan created PR review comment:

Right!!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:40):

khagankhan commented on PR #10924:

Thanks, Nick! currently working on it. Will integrate your suggestions in the next commit.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 12 2025 at 18:40):

khagankhan edited a comment on PR #10924:

Thanks, @fitzgen! currently working on it. Will integrate your suggestions in the next commit.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 16:26):

khagankhan updated PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 16:37):

khagankhan submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 16:37):

khagankhan created PR review comment:

Removed.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 16:37):

khagankhan submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 16:37):

khagankhan created PR review comment:

Added

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 16:37):

khagankhan submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 16:37):

khagankhan created PR review comment:

added new methods instead of macros

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 16:37):

khagankhan submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 16:37):

khagankhan created PR review comment:

Done

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 16:38):

khagankhan submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 16:38):

khagankhan created PR review comment:

Added new empty() method

view this post on Zulip Wasmtime GitHub notifications bot (Jun 27 2025 at 11:12):

khagankhan updated PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 27 2025 at 11:51):

khagankhan updated PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 27 2025 at 12:33):

khagankhan requested alexcrichton for a review on PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 27 2025 at 12:33):

khagankhan requested wasmtime-default-reviewers for a review on PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 27 2025 at 12:33):

khagankhan updated PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 27 2025 at 14:28):

alexcrichton requested fitzgen for a review on PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 27 2025 at 15:18):

khagankhan updated PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 27 2025 at 15:32):

khagankhan updated PR #10924.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 27 2025 at 16:15):

fitzgen submitted PR review:

Looks great! Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 27 2025 at 16:38):

fitzgen merged PR #10924.


Last updated: Dec 06 2025 at 06:05 UTC