Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve debug output of differential fuzzing #1340

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented Jan 22, 2025

Using the new FuzzInput struct we now have properly supported Debug output on detected fuzzing failure test cases.

  • This debug output shows the chosen Wasm runtime oracle, the wasm_smith module configuration and the Wasm source as .wat source code.
  • In contrast to the already implemented crash-inputs feature this information is properly displayed on CI consoles.

Example

Failing input:

        fuzz/artifacts/differential/crash-ec8b55496c8cf9fd654f076239bf3f25d37e6a43

Output of `std::fmt::Debug`:

        FuzzInput {
            chosen_oracle: Wasmtime,
            module: Module {
                config: Config {
                    available_imports: None,
                    exports: None,
                    allow_start_export: true,
                    allowed_instructions: InstructionKinds(
                        FlagSet(NumericInt | Numeric | VectorInt | Vector | Reference | Parametric | Variable | Table | MemoryInt | Memory | Control | Aggregate),
                    ),
                    allow_floats: true,
                    bulk_memory_enabled: true,
                    canonicalize_nans: true,
                    disallow_traps: false,
                    exceptions_enabled: false,
                    export_everything: true,
                    gc_enabled: false,
                    custom_page_sizes_enabled: false,
                    generate_custom_sections: false,
                    max_aliases: 1000,
                    max_components: 10,
                    max_data_segments: 10,
                    max_element_segments: 253,
                    max_elements: 973,
                    max_exports: 297,
                    max_funcs: 740,
                    max_globals: 910,
                    max_imports: 70,
                    max_instances: 10,
                    max_instructions: 917,
                    max_memories: 25,
                    max_memory32_bytes: 1040383744,
                    max_memory64_bytes: 0,
                    max_modules: 10,
                    max_nesting_depth: 10,
                    max_table_elements: 183033,
                    max_tables: 1,
                    max_tags: 0,
                    max_type_size: 1000,
                    max_types: 507,
                    max_values: 10,
                    memory64_enabled: false,
                    memory_max_size_required: false,
                    memory_offset_choices: MemoryOffsetChoices(
                        90,
                        9,
                        1,
                    ),
                    min_data_segments: 0,
                    min_element_segments: 0,
                    min_elements: 0,
                    min_exports: 0,
                    min_funcs: 0,
                    min_globals: 0,
                    min_imports: 0,
                    min_memories: 0,
                    min_tables: 0,
                    min_tags: 0,
                    min_types: 0,
                    min_uleb_size: 0,
                    multi_value_enabled: true,
                    reference_types_enabled: false,
                    relaxed_simd_enabled: false,
                    saturating_float_to_int_enabled: true,
                    sign_extension_ops_enabled: true,
                    shared_everything_threads_enabled: false,
                    simd_enabled: false,
                    tail_call_enabled: true,
                    table_max_size_required: false,
                    threads_enabled: false,
                    allow_invalid_funcs: false,
                    wide_arithmetic_enabled: false,
                    extended_const_enabled: true,
                },
                ...: "...",
            },
            wasm: 
            (module
              (type (;0;) (func))
              (global (;0;) (mut i32) i32.const 1000)
              (export "" (func 0))
              (func (;0;) (type 0)
                global.get 0
                i32.eqz
                if ;; label = @1
                  unreachable
                end
                global.get 0
                i32.const 1
                i32.sub
                global.set 0
              )
            )
            ,
        }

Reproduce with:

        cargo fuzz run -O --features=differential differential fuzz/artifacts/differential/crash-ec8b55496c8cf9fd654f076239bf3f25d37e6a43

Minimize test case with:

        cargo fuzz tmin -O --features=differential differential fuzz/artifacts/differential/crash-ec8b55496c8cf9fd654f076239bf3f25d37e6a43

────────────────────────────────────────────────────────────────────────────────

Error: Fuzz target exited with exit status: 77

Using the new FuzzInput struct we now have properly supported Debug output on detected fuzzing failure test cases.

This debug output shows the chosen oracle, the module configuration and the Wasm source as `.wat` source code.
@Robbepop Robbepop merged commit 53f2179 into main Jan 22, 2025
15 of 17 checks passed
@Robbepop Robbepop deleted the rf-improve-differential-fuzzing-debug-output branch January 22, 2025 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant