Skip to content

Commit

Permalink
Add general fuzzing support for custom page sizes (#9462)
Browse files Browse the repository at this point in the history
* Add general fuzzing support for custom page sizes

* Add custom-page-sizes as an expected feature for module generation
  • Loading branch information
fitzgen authored Oct 16, 2024
1 parent 8d32008 commit edad0bb
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions crates/fuzzing/src/generators/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ impl Config {
.wasm_threads(self.module_config.config.threads_enabled)
.wasm_function_references(self.module_config.config.gc_enabled)
.wasm_gc(self.module_config.config.gc_enabled)
.wasm_custom_page_sizes(self.module_config.config.custom_page_sizes_enabled)
.wasm_wide_arithmetic(self.module_config.config.wide_arithmetic_enabled)
.native_unwind_info(cfg!(target_os = "windows") || self.wasmtime.native_unwind_info)
.cranelift_nan_canonicalization(self.wasmtime.canonicalize_nans)
Expand Down
3 changes: 1 addition & 2 deletions crates/fuzzing/src/generators/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,13 @@ impl<'a> Arbitrary<'a> for ModuleConfig {
let _ = config.tail_call_enabled;
config.exceptions_enabled = false;
config.gc_enabled = false;
config.custom_page_sizes_enabled = u.arbitrary()?;
config.wide_arithmetic_enabled = u.arbitrary()?;
config.memory64_enabled = u.ratio(1, 20)?;
// Allow the threads proposal if memory64 is not already enabled. FIXME:
// to allow threads and memory64 to coexist, see
// https://github.com/bytecodealliance/wasmtime/issues/4267.
config.threads_enabled = !config.memory64_enabled && u.ratio(1, 20)?;
// FIXME: this may be safe to enable
config.custom_page_sizes_enabled = false;
// Allow multi-memory but make it unlikely
if u.ratio(1, 20)? {
config.max_memories = config.max_memories.max(2);
Expand Down
3 changes: 2 additions & 1 deletion crates/fuzzing/src/oracles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,8 @@ mod tests {
| WasmFeatures::TAIL_CALL
| WasmFeatures::WIDE_ARITHMETIC
| WasmFeatures::MEMORY64
| WasmFeatures::GC_TYPES;
| WasmFeatures::GC_TYPES
| WasmFeatures::CUSTOM_PAGE_SIZES;

// All other features that wasmparser supports, which is presumably a
// superset of the features that wasm-smith supports, are listed here as
Expand Down
1 change: 1 addition & 0 deletions crates/fuzzing/src/oracles/diff_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ impl SpecInterpreter {
config.reference_types_enabled = false;
config.tail_call_enabled = false;
config.relaxed_simd_enabled = false;
config.custom_page_sizes_enabled = false;
config.wide_arithmetic_enabled = false;

Self
Expand Down
1 change: 1 addition & 0 deletions crates/fuzzing/src/oracles/diff_v8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ impl V8Engine {
config.min_memories = config.min_memories.min(1);
config.max_memories = config.max_memories.min(1);
config.memory64_enabled = false;
config.custom_page_sizes_enabled = false;
config.wide_arithmetic_enabled = false;

Self {
Expand Down
1 change: 1 addition & 0 deletions crates/fuzzing/src/oracles/diff_wasmi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ impl WasmiEngine {
config.threads_enabled = false;
config.exceptions_enabled = false;
config.gc_enabled = false;
config.custom_page_sizes_enabled = false;
config.wide_arithmetic_enabled = false;

let mut wasmi_config = wasmi::Config::default();
Expand Down
4 changes: 1 addition & 3 deletions docs/stability-wasm-proposals.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,14 @@ column is below.
| [`function-references`] |||||||
| [`gc`] [^6] |||[^7] ||||
| [`wide-arithmetic`] |||||||
| [`custom-page-sizes`] ||| | ⚠️[^8] |||
| [`custom-page-sizes`] ||| | |||

[^6]: There is also a [tracking
issue](https://github.com/bytecodealliance/wasmtime/issues/5032) for the
GC proposal.
[^7]: The implementation of GC has [known performance
issues](https://github.com/bytecodealliance/wasmtime/issues/9351) which can
affect non-GC code when the GC proposal is enabled.
[^8]: A custom fuzzer exists but this isn't enabled yet for general-purpose
fuzzing.

## Unimplemented proposals

Expand Down

0 comments on commit edad0bb

Please sign in to comment.