FlowExecutor

Trait FlowExecutor 

Source
pub trait FlowExecutor:
    Send
    + 'static
    + Sized {
Show 19 methods // Required methods fn new() -> Self; fn execute_flows( &mut self, flow_calls_per_iteration: u64, ) -> Result<(), FuzzingError>; fn trident_mut(&mut self) -> &mut Trident; fn reset_fuzz_accounts(&mut self); fn handle_llvm_coverage(&mut self, current_iteration: u64); // Provided methods fn fuzz(iterations: u64, flow_calls_per_iteration: u64) { ... } fn setup_panic_handler() { ... } fn extract_panic_message(panic_err: &Box<dyn Any + Send>) -> String { ... } fn handle_panic( panic_err: &Box<dyn Any + Send>, fuzzer: &mut Self, panic_occurred: Option<&Arc<AtomicBool>>, ) -> String { ... } fn determine_exit_code( with_exit_code: bool, panic_occurred: bool, fuzzing_data: &TridentFuzzingData, ) -> i32 { ... } fn get_or_generate_master_seed() -> [u8; 32] { ... } fn parse_hex_seed(seed_hex: &str) -> [u8; 32] { ... } fn generate_random_seed() -> [u8; 32] { ... } fn output_metrics_if_enabled(fuzzing_data: &TridentFuzzingData) { ... } fn fuzz_single_threaded(iterations: u64, flow_calls_per_iteration: u64) { ... } fn fuzz_parallel( iterations: u64, flow_calls_per_iteration: u64, num_threads: usize, master_seed: [u8; 32], ) { ... } fn run_thread_workload( master_seed: [u8; 32], thread_id: usize, thread_iterations: u64, flow_calls_per_iteration: u64, progress_bar: ProgressBar, panic_occurred: Arc<AtomicBool>, ) -> TridentFuzzingData { ... } fn handle_coverage_if_enabled(fuzzer: &mut Self, current_iteration: u64) { ... } fn notify_coverage_extension() { ... }
}
Expand description

Trait for executing fuzzing flows in the Trident framework

This trait defines the interface for fuzzing executors that can run multiple iterations of randomized program interactions. Implementors should provide the core fuzzing logic while this trait handles parallelization, progress tracking, and metrics collection.

Required Methods§

Source

fn new() -> Self

Creates a new instance of the flow executor

Source

fn execute_flows( &mut self, flow_calls_per_iteration: u64, ) -> Result<(), FuzzingError>

Executes a specified number of flow calls in a single iteration

§Arguments
  • flow_calls_per_iteration - Number of individual flow calls to execute
§Returns

Result indicating success or a fuzzing error

Source

fn trident_mut(&mut self) -> &mut Trident

Returns a mutable reference to the underlying Trident instance

Source

fn reset_fuzz_accounts(&mut self)

Resets fuzz accounts to their initial state for the next iteration

Source

fn handle_llvm_coverage(&mut self, current_iteration: u64)

Handles LLVM coverage collection (generated by macro)

This method is typically empty or contains LLVM coverage calls depending on whether coverage profiling is enabled.

§Arguments
  • current_iteration - The current iteration number

Provided Methods§

Source

fn fuzz(iterations: u64, flow_calls_per_iteration: u64)

Main entry point for fuzzing execution

This method orchestrates the entire fuzzing process, handling both single-threaded and parallel execution based on the environment and available system resources.

§Arguments
  • iterations - Total number of fuzzing iterations to run
  • flow_calls_per_iteration - Number of flow calls per iteration
Source

fn setup_panic_handler()

Sets up a global panic handler that captures panic location information. This allows us to retrieve the file, line, and column where a panic occurred even after catching it with catch_unwind.

Source

fn extract_panic_message(panic_err: &Box<dyn Any + Send>) -> String

Extracts the panic message from a panic payload. Panics can have either &str or String payloads, so we handle both cases.

Source

fn handle_panic( panic_err: &Box<dyn Any + Send>, fuzzer: &mut Self, panic_occurred: Option<&Arc<AtomicBool>>, ) -> String

Handles a caught panic by logging it and updating the panic tracking flag. Returns the formatted panic message for display.

Source

fn determine_exit_code( with_exit_code: bool, panic_occurred: bool, fuzzing_data: &TridentFuzzingData, ) -> i32

Determines the exit code based on panic status and configuration. Returns 99 if with_exit_code is enabled and panics occurred, otherwise uses metrics exit code.

Source

fn get_or_generate_master_seed() -> [u8; 32]

Gets the master seed from environment variable or generates a random one. The master seed is used to initialize all fuzzer instances for reproducible runs.

Source

fn parse_hex_seed(seed_hex: &str) -> [u8; 32]

Parses a hex-encoded seed string into a byte array. Validates that the seed is exactly the required size.

Source

fn generate_random_seed() -> [u8; 32]

Generates a cryptographically secure random seed.

Source

fn output_metrics_if_enabled(fuzzing_data: &TridentFuzzingData)

Outputs fuzzing metrics (JSON, dashboard, etc.) if metrics are enabled.

Source

fn fuzz_single_threaded(iterations: u64, flow_calls_per_iteration: u64)

Executes fuzzing in a single thread. This is used for debug mode, small iteration counts, or when only one thread is available.

Source

fn fuzz_parallel( iterations: u64, flow_calls_per_iteration: u64, num_threads: usize, master_seed: [u8; 32], )

Executes fuzzing across multiple threads for better performance. Each thread runs a subset of iterations with its own fuzzer instance.

Source

fn run_thread_workload( master_seed: [u8; 32], thread_id: usize, thread_iterations: u64, flow_calls_per_iteration: u64, progress_bar: ProgressBar, panic_occurred: Arc<AtomicBool>, ) -> TridentFuzzingData

Runs the fuzzing workload for a single thread. This is extracted to reduce complexity in fuzz_parallel.

Source

fn handle_coverage_if_enabled(fuzzer: &mut Self, current_iteration: u64)

Handles LLVM coverage collection if coverage profiling is enabled. Coverage is collected periodically based on FUZZER_LOOPCOUNT environment variable.

Source

fn notify_coverage_extension()

Notifies the VS Code coverage extension to update coverage decorations. This runs in a background thread to avoid blocking fuzzing execution.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§