From b8fa068ca8a3ab4b0750f5eceba72c20caabb5cf Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 16 Sep 2022 13:50:49 -0500 Subject: [PATCH] Limit linear memories when fuzzing with pooling (#4918) This commit limits the maximum number of linear memories when the pooling allocator is used to ensure that the virtual memory mapping for the pooling allocator itself can succeed. Currently there are a number of crashes in the differential fuzzer where the pooling allocator can't allocate its mapping because the maximum specified number of linear memories times the number of instances exceeds the address space presumably. --- crates/fuzzing/src/generators/config.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/fuzzing/src/generators/config.rs b/crates/fuzzing/src/generators/config.rs index bbea237c3..4b94f278b 100644 --- a/crates/fuzzing/src/generators/config.rs +++ b/crates/fuzzing/src/generators/config.rs @@ -349,6 +349,11 @@ impl<'a> Arbitrary<'a> for Config { } }; + // Don't allow too many linear memories per instance since massive + // virtual mappings can fail to get allocated. + cfg.min_memories = cfg.min_memories.min(10); + cfg.max_memories = cfg.max_memories.min(10); + // Force this pooling allocator to always be able to accommodate the // module that may be generated. limits.memories = cfg.max_memories as u32;