Skip to content

Commit

Permalink
Limit linear memories when fuzzing with pooling (#4918)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexcrichton authored Sep 16, 2022
1 parent f558095 commit b8fa068
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/fuzzing/src/generators/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b8fa068

Please sign in to comment.