#[repr(C)]pub(crate) struct Tsffs {Show 109 fields
pub(crate) conf_object: ConfObject,
pub all_breakpoints_are_solutions: bool,
pub all_exceptions_are_solutions: bool,
pub exceptions: BTreeSet<i64>,
pub breakpoints: BTreeSet<BreakpointId>,
pub timeout: f64,
pub snapshot_restore_interval: SnapshotRestorePolicy,
pub start_on_harness: bool,
pub stop_on_harness: bool,
pub repro_auto_continue: bool,
pub magic_start_index: u64,
pub magic_stop_indices: Vec<u64>,
pub magic_assert_indices: Vec<u64>,
pub iteration_limit: usize,
pub initial_random_corpus_size: usize,
pub corpus_directory: PathBuf,
pub solutions_directory: PathBuf,
pub generate_random_corpus: bool,
pub selective_instrumentation: bool,
pub cmplog: bool,
pub coverage_reporting: bool,
pub token_executables: Vec<PathBuf>,
pub token_src_files: Vec<PathBuf>,
pub token_files: Vec<PathBuf>,
pub tokens: Vec<Vec<u8>>,
pub checkpoint_path: PathBuf,
pub pre_snapshot_checkpoint: bool,
pub log_path: PathBuf,
pub log_to_file: bool,
pub keep_all_corpus: bool,
pub use_initial_as_corpus: bool,
pub debug_log_libafl: bool,
pub shutdown_on_stop_without_reason: bool,
pub quit_on_iteration_limit: bool,
pub save_timeout_execution_traces: bool,
pub save_solution_execution_traces: bool,
pub save_interesting_execution_traces: bool,
pub save_all_execution_traces: bool,
pub execution_trace_directory: PathBuf,
pub execution_trace_pc_only: bool,
pub heartbeat: bool,
pub heartbeat_interval: u64,
pub afl_stats: bool,
pub afl_stats_interval: u64,
pub output_directory: PathBuf,
pub instance_name: String,
pub symbolic_coverage: bool,
pub windows: bool,
pub debuginfo_download_directory: PathBuf,
pub debug_info: HashMap<String, Vec<PathBuf>>,
pub debuginfo_source_directory: PathBuf,
pub symbolic_coverage_system: bool,
pub symbolic_coverage_directory: PathBuf,
pub last_exception_processor_number: Option<i32>,
pub last_stop_reason: Option<String>,
pub(crate) stop_hap_handle: HapHandle,
pub(crate) breakpoint_memop_hap_handle: HapHandle,
pub(crate) exception_hap_handle: HapHandle,
pub(crate) magic_hap_handle: HapHandle,
pub(crate) control_register_write_hap_handle: HapHandle,
pub architecture_hints: HashMap<i32, ArchitectureHint>,
pub(crate) fuzz_thread: OnceCell<JoinHandle<Result<()>>>,
pub(crate) fuzzer_tx: OnceCell<Sender<ExitKind>>,
pub(crate) fuzzer_rx: OnceCell<Receiver<Testcase>>,
pub(crate) fuzzer_shutdown: OnceCell<Sender<ShutdownMessage>>,
pub(crate) fuzzer_messages: OnceCell<Receiver<FuzzerMessage>>,
pub(crate) coverage_map: OnceCell<OwnedMutSlice<'static, u8>>,
pub(crate) aflpp_cmp_map_ptr: OnceCell<*mut AFLppCmpLogMap>,
pub(crate) aflpp_cmp_map: OnceCell<&'static mut AFLppCmpLogMap>,
pub(crate) coverage_prev_loc: u64,
pub(crate) timeout_event: OnceCell<Event>,
pub(crate) edges_seen: HashSet<u64>,
pub(crate) edges_seen_since_last: HashMap<u64, u64>,
pub(crate) execution_trace: ExecutionTrace,
pub(crate) coverage: Records,
pub(crate) snapshot_name: OnceCell<String>,
pub(crate) micro_checkpoint_index: OnceCell<i32>,
pub(crate) stop_reason: Option<StopReason>,
pub(crate) start_info: OnceCell<StartInfo>,
pub(crate) start_time: OnceCell<SystemTime>,
pub(crate) last_heartbeat_time: Option<SystemTime>,
pub(crate) log: OnceCell<File>,
pub(crate) afl_writer: Option<InstanceWriter>,
pub(crate) last_afl_stats_time: Option<SystemTime>,
pub(crate) last_find_time: Option<SystemTime>,
pub(crate) last_crash_time: Option<SystemTime>,
pub(crate) last_hang_time: Option<SystemTime>,
pub(crate) iterations_at_last_crash: usize,
pub(crate) afl_snapshot: SharedSnapshot,
pub(crate) afl_snapshot_generation: u64,
pub(crate) afl_fuzzer_snapshot: Option<FuzzerSnapshot>,
pub(crate) afl_corpus_count: u64,
pub(crate) afl_edges_found: u64,
pub(crate) coverage_enabled: bool,
pub(crate) cmplog_enabled: bool,
pub(crate) start_processor_number: OnceCell<i32>,
pub(crate) processors: HashMap<i32, Architecture>,
pub(crate) instrumented_processors: HashSet<i32>,
pub(crate) cached_feedback_error_reported: bool,
pub(crate) repro_testcase: Option<Vec<u8>>,
pub(crate) repro_bookmark_set: bool,
pub(crate) stopped_for_repro: bool,
pub(crate) iterations: usize,
pub(crate) use_snapshots: bool,
pub(crate) timeouts: usize,
pub(crate) solutions: usize,
pub(crate) windows_os_info: WindowsOsInfo,
pub(crate) cr3_cache: HashMap<i32, i64>,
pub(crate) source_file_cache: SourceCache,
}Expand description
The main module class for the TSFFS fuzzer, stores state and configuration information
Fields§
§conf_object: ConfObject§all_breakpoints_are_solutions: boolWhether all breakpoints are treated as solutions. When set to True, any breakpoint
which triggers a Core_Breakpoint_Memop HAP will be treated as a solution. This allows
setting memory breakpoints on specific memory locations to trigger a solution when the
memory is read, written, or executed. Not all breakpoints cause this HAP to occur.
For example, to set an execution breakpoint on the address $addr:
$addr = 0x100000 $bp = (bp.memory.break -x $addr) @tsffs.all_breakpoints_are_solutions = True
Tsffs will treat the breakpoint as a solution (along with all other breakpoints), and the fuzzer will stop when the breakpoint is hit.
all_exceptions_are_solutions: boolWhether all exceptions are treated as solutions. When set to True, any CPU exception
or interrupt which triggers a Core_Exception HAP will be treated as a solution. This
can be useful when enabled in a callback after which any exception is considered a
solution and is typically not useful when enabled during the start-up process because
most processors will generate exceptions during start-up and during normal operation.
exceptions: BTreeSet<i64>The set of exceptions which are treated as solutions. For example on x86_64, setting:
@tsffs.exceptions = [14]
would treat any page fault as a solution.
breakpoints: BTreeSet<BreakpointId>The set of breakpoints which are treated as solutions. For example, to set a solution breakpoint on the address $addr (note the breakpoint set from the Simics command is accessed through the simenv namespace):
$addr = 0x100000 $bp = (bp.memory.break -x $addr) @tsffs.breakpoints = [simenv.bp]
timeout: f64The timeout in seconds of virtual time for each iteration of the fuzzer. If the virtual time timeout is exceeded for a single iteration, the iteration is stopped and the testcase is saved as a solution.
snapshot_restore_interval: SnapshotRestorePolicySnapshot restore policy for normal iteration boundaries.
Accepted values:
1restores on every normal iteration (default)N > 1restores every N iterations based on the global iteration count0disables restores after startup
Solution iterations always restore the initial snapshot before resuming if one exists.
start_on_harness: boolWhether the fuzzer should start on compiled-in harnesses. If set to True, the fuzzer
will start fuzzing when a harness macro is executed.
stop_on_harness: boolWhether the fuzzer should stop on compiled-in harnesses. If set to True, the fuzzer
will start fuzzing when a harness macro is executed.
repro_auto_continue: boolWhether TSFFS should automatically resume simulation after preparing a repro testcase.
When set to False, TSFFS will prepare repro execution state (snapshot restore,
testcase write, timeout event, bookmark) but not call continue. This is useful when
an external debugger (for example a GDB stub) should control resume.
magic_start_index: u64The index number which is passed to the platform-specific magic instruction HAP by a compiled-in harness to signal that the fuzzer should start the fuzzing loop.
This option is useful when fuzzing a target which has multiple start harnesses compiled into it, and the fuzzer should start on a specific harness.
There can only be one magic start value, because only one fuzzing loop can be running
(and they cannot be nested). This only has an effect if start_on_harness is set.
magic_stop_indices: Vec<u64>The magic numbers which is passed to the platform-specific magic instruction HAP by a compiled-in harness to signal that the fuzzer should stop execution of the current iteration.
This option is useful when fuzzing a target which has multiple stop harnesses compiled into it, and the fuzzer should stop on a specific subset of stop harness macro calls.
This only has an effect if stop_on_harness is set.
magic_assert_indices: Vec<u64>The numbers which are passed to the platform-specific magic instruction HAP by a compiled-in harness to signal that the fuzzer should stop execution of the current iteration and save the testcase as a solution.
This only has an effect if stop_on_harness is set.
iteration_limit: usizeThe limit on the number of fuzzing iterations to execute. If set to 0, the fuzzer will run indefinitely. If set to a positive integer, the fuzzer will run until the limit is reached.
initial_random_corpus_size: usizeThe size of the corpus to generate randomly. If generate_random_corpus is set to
True, the fuzzer will generate a random corpus of this size before starting the
fuzzing loop.
corpus_directory: PathBufThe directory to load the corpus from and save new corpus items to. This directory
may be a SIMICS relative path prefixed with “%simics%”. It is an error to provide no
corpus directory when set_generate_random_corpus(True) has not been called prior to
fuzzer startup. It is also an error to provide an empty corpus directory without
calling set_generate_random_corpus(True). If not provided, “%simics%/corpus” will
be used by default.
solutions_directory: PathBufThe directory to save solutions to. This directory may be a SIMICS relative path prefixed with “%simics%”. If not provided, “%simics%/solutions” will be used by default.
generate_random_corpus: boolWhether to generate a random corpus before starting the fuzzing loop. If set to True,
the fuzzer will generate a random corpus of size initial_random_corpus_size before
starting the fuzzing loop. This should generally be used only for debugging and testing
purposes, and is not recommended for use in production. A real corpus representative of
both valid and invalid inputs should be used in production.
selective_instrumentation: boolWhether to use selective instrumentation on x86-64 and i386 processors. When enabled,
each instruction is classified once when Simics adds it to its instruction cache, and
callbacks are attached only to branches and (with cmplog) comparisons, instead of
running a callback on every executed instruction. Feedback is unchanged. Execution
trace saving and symbolic coverage still use per-instruction callbacks. Must be set
before fuzzing starts.
cmplog: boolWhether comparison logging should be used during fuzzing to enable value-driven
mutations. If set to True, the fuzzer will use comparison logging to enable
value-driven mutations. This should always be enabled unless the target is known to
not benefit from value-driven mutations or run too slowly when solving for comparison
values.
coverage_reporting: boolWhether coverage reporting should be enabled. When enabled, new edge addresses will be logged.
token_executables: Vec<PathBuf>A set of executable files to tokenize. Tokens will be extracted from these files and used to drive token mutations of testcases.
token_src_files: Vec<PathBuf>A set of source files to tokenize. Tokens will be extracted from these files and used to drive token mutations of testcases. C source files are expected, and strings and tokens will be extracted from strings in the source files.
token_files: Vec<PathBuf>Files in the format of:
x = “hello” y = “foo\x41bar”
which will be used to drive token mutations of testcases.
tokens: Vec<Vec<u8>>Sets of tokens to use to drive token mutations of testcases. Each token set is a bytes which will be randomically inserted into testcases.
checkpoint_path: PathBufThe path to the checkpoint saved prior to fuzzing when using snapshots
pre_snapshot_checkpoint: bool§log_path: PathBufThe path to the log file which will be used to log the fuzzer’s output statistics
log_to_file: bool§keep_all_corpus: bool§use_initial_as_corpus: boolWhether to use the initial contents of the testcase buffer as an entry in the corpus
debug_log_libafl: boolWhether to enable extra debug logging for LibAFL
shutdown_on_stop_without_reason: boolWhether to send shut down on stops without reason. This means fuzzing cannot be resumed.
quit_on_iteration_limit: boolWhether to quit on iteration limit
save_timeout_execution_traces: boolWhether to save execution traces of test cases which result in a timeout
save_solution_execution_traces: boolWhether to save execution traces of test cases which result in a solution
save_interesting_execution_traces: boolWhether to save execution traces of test cases which result in an interesting input
save_all_execution_traces: boolWhether to save all execution traces. This will consume a very large amount of resources and should only be used for debugging and testing purposes.
execution_trace_directory: PathBufThe directory to save execution traces to, if any are set to be saved. This directory may be a SIMICS relative path prefixed with “%simics%”. If not provided, “%simics%/execution-traces” will be used by default.
execution_trace_pc_only: boolWhether execution traces should include just PC (vs instruction text and bytes)
heartbeat: boolWhether a heartbeat message should be emitted every heartbeat_interval seconds
heartbeat_interval: u64The interval in seconds between heartbeat messages
afl_stats: boolWhether AFL++-compatible statistics (fuzzer_stats) are maintained in the Instance
directory <output_directory>/<instance_name>/ while fuzzing.
afl_stats_interval: u64The wall-clock interval in seconds between AFL statistics writes. The interval is checked each time the simulation stops, so a long iteration delays the next write.
output_directory: PathBufThe directory containing one Instance directory per fuzzing session. If not provided, “%simics%/output” will be used by default.
instance_name: StringThe name of this session’s Instance directory under output_directory. It may contain
only letters, digits, ‘.’, ‘_’ and ‘-’, and may not consist only of dots.
symbolic_coverage: boolWhether symbolic coverage should be used during fuzzing
windows: boolWhether windows is being run in the simulation
debuginfo_download_directory: PathBufDirectory in which to download PDB and EXE files from symbol servers on Windows
debug_info: HashMap<String, Vec<PathBuf>>Mapping of file name (name and extension e.g. fuzzer-app.exe or target.sys) to a tuple of (exe path, debuginfo path) where debuginfo is either a PDB or DWARF file
debuginfo_source_directory: PathBufDirectory in which source files are located. Source files do not need to be arranged in the same directory structure as the compiled source, and are looked up by hash.
symbolic_coverage_system: boolWhether symbolic coverage should be collected for system components by downloading executable and debug info files where possible.
symbolic_coverage_directory: PathBufDirectory in which source files are located. Source files do not need to be arranged in the same directory structure as the compiled source, and are looked up by hash.
last_exception_processor_number: Option<i32>The processor number of the processor which raised the most recently detected
exception-based solution. Nil if no exception-based solution has been detected
since the start of the current iteration.
This attribute is informational and transient: it reflects internal fuzzer state, is cleared at the start of each iteration, and is not saved across checkpoints. Setting it has no effect on fuzzing behavior; it will be overwritten at the next exception-based solution or clear point.
last_stop_reason: Option<String>The reason the simulation most recently stopped, in the same serialized form
used internally by the fuzzer. Nil if the simulation has not stopped since the
start of the current iteration.
This attribute is informational and transient: it reflects internal fuzzer state, is cleared at the start of each iteration, and is not saved across checkpoints. Setting it has no effect on fuzzing behavior; it will be overwritten at the next exception-based solution or clear point.
stop_hap_handle: HapHandleHandle for the core simulation stopped hap
breakpoint_memop_hap_handle: HapHandleHandle for the core breakpoint memop hap
exception_hap_handle: HapHandleHandle for exception HAP
magic_hap_handle: HapHandleThe handle for the registered magic HAP, used to
listen for magic start and stop if start_on_harness
or stop_on_harness are set.
control_register_write_hap_handle: HapHandleHandle for the core control register write hap
architecture_hints: HashMap<i32, ArchitectureHint>A mapping of architecture hints from CPU index to architecture hint. This architecture hint overrides the detected architecture of the CPU core. This is useful when the architecture of the CPU core is not detected correctly, or when the architecture of the CPU core is not known at the time the fuzzer is started. Specifically, x86 cores which report their architecture as x86_64 can be overridden to x86.
fuzz_thread: OnceCell<JoinHandle<Result<()>>>Fuzzer thread
fuzzer_tx: OnceCell<Sender<ExitKind>>Message sender to the fuzzer thread. TSFFS sends exit kinds to the fuzzer thread to report whether testcases resulted in normal exit, timeout, or solutions.
fuzzer_rx: OnceCell<Receiver<Testcase>>Message receiver from the fuzzer thread. TSFFS receives new testcases and run configuration from the fuzzer thread.
fuzzer_shutdown: OnceCell<Sender<ShutdownMessage>>A message sender to inform the fuzzer thread that it should exit.
fuzzer_messages: OnceCell<Receiver<FuzzerMessage>>Reciever from the fuzzer thread to receive messages from the fuzzer thread including status messages and structured introspection data like new edge findings.
coverage_map: OnceCell<OwnedMutSlice<'static, u8>>The coverage map
aflpp_cmp_map_ptr: OnceCell<*mut AFLppCmpLogMap>A pointer to the AFL++ comparison map
aflpp_cmp_map: OnceCell<&'static mut AFLppCmpLogMap>The owned AFL++ comparison map
coverage_prev_loc: u64The previous location for coverage for calculating the hash of edges.
timeout_event: OnceCell<Event>The registered timeout event which is registered and used to detect timeouts in virtual time
edges_seen: HashSet<u64>The set of edges which have been seen at least once.
edges_seen_since_last: HashMap<u64, u64>A map of the new edges to their AFL indices seen since the last time the fuzzer provided an update. This is not cleared every execution.
execution_trace: ExecutionTraceThe set of PCs comprising the current execution trace. This is cleared every execution.
coverage: RecordsThe current line coverage state comprising the total execution. This is not cleared and is persistent across the full campaign until the fuzzer stops.
snapshot_name: OnceCell<String>The name of the fuzz snapshot, if saved
micro_checkpoint_index: OnceCell<i32>The index of the micro checkpoint saved for the fuzzer. Only present if not using snapshots.
stop_reason: Option<StopReason>The reason the current stop occurred
start_info: OnceCell<StartInfo>The buffer and size information, if saved
start_time: OnceCell<SystemTime>The time the fuzzer was started at
last_heartbeat_time: Option<SystemTime>The time the fuzzer was started at
log: OnceCell<File>§afl_writer: Option<InstanceWriter>The writer for this session’s AFL Instance, once the session has started
last_afl_stats_time: Option<SystemTime>When AFL statistics were last written
last_find_time: Option<SystemTime>When the last interesting input was found
last_crash_time: Option<SystemTime>When the last crash happened
last_hang_time: Option<SystemTime>When the last timeout happened
iterations_at_last_crash: usizeThe iteration count at the last crash
afl_snapshot: SharedSnapshotThe latest counts published by the fuzzer thread’s TsffsAflStatsStage
afl_snapshot_generation: u64The generation of the newest snapshot taken from afl_snapshot
afl_fuzzer_snapshot: Option<FuzzerSnapshot>The newest snapshot taken from afl_snapshot
afl_corpus_count: u64Live corpus size: bumped for each Interesting message, overwritten by snapshots
afl_edges_found: u64Live Edge count: bumped by the Edges each Interesting message adds, overwritten by
snapshots
coverage_enabled: boolWhether cmplog is currently enabled
cmplog_enabled: boolWhether cmplog is currently enabled
start_processor_number: OnceCell<i32>The number of the processor which starts the fuzzing loop (via magic or manual methods)
processors: HashMap<i32, Architecture>Tracked processors. This always includes the start processor, and may include additional processors that are manually added by the user
instrumented_processors: HashSet<i32>Tracked processors whose feedback callbacks have been subscribed
cached_feedback_error_reported: boolWhether a cached-instruction callback failure has already been reported
repro_testcase: Option<Vec<u8>>A testcase to use for repro
repro_bookmark_set: boolWhether a bookmark has been set for repro mode
stopped_for_repro: boolWhether the fuzzer is currently stopped in repro mode
iterations: usizeThe number of iterations which have been executed so far
use_snapshots: boolWhether snapshots are used. Snapshots are used on Simics 7.0.0 and later.
timeouts: usizeThe number of timeouts so far
solutions: usizeThe number of solutions so far
windows_os_info: WindowsOsInfo§cr3_cache: HashMap<i32, i64>§source_file_cache: SourceCacheImplementations§
Source§impl Tsffs
impl Tsffs
Sourcepub fn start_afl_stats(&mut self) -> Result<()>
pub fn start_afl_stats(&mut self) -> Result<()>
Create this session’s Instance and write the first stats. Called once when the session
starts. Configuration mistakes (an invalid instance_name, an Instance in use) fail the
session; environmental problems (unwritable directory, no file locking, a locked
plot_data) only warn and run without statistics.
Sourcefn setup_attributes(&self) -> Vec<(String, String)>
fn setup_attributes(&self) -> Vec<(String, String)>
The configuration recorded once in fuzzer_setup
Sourcefn refresh_from_fuzzer_snapshot(&mut self)
fn refresh_from_fuzzer_snapshot(&mut self)
Take the newest snapshot the fuzzer thread has published, if any. Its corpus and Edge
counts are authoritative and overwrite the live counts bumped from Interesting messages.
Sourcepub fn afl_stats_tick(&mut self, force: bool)
pub fn afl_stats_tick(&mut self, force: bool)
Write AFL statistics if afl_stats_interval seconds have passed since the last write,
or unconditionally when force is set. Never fails: problems are reported as log
messages so that monitoring cannot stop fuzzing.
Source§impl Tsffs
impl Tsffs
const EDGES_OBSERVER_NAME: &'static str = "coverage"
const AFLPP_CMP_OBSERVER_NAME: &'static str = "aflpp_cmplog"
const CMPLOG_OBSERVER_NAME: &'static str = "cmplog"
const TIME_OBSERVER_NAME: &'static str = "time"
const CORPUS_CACHE_SIZE: usize = 4096
Sourcepub fn start_fuzzer_thread(&mut self) -> Result<()>
pub fn start_fuzzer_thread(&mut self) -> Result<()>
Start the fuzzing thread.
pub fn send_shutdown(&mut self) -> Result<()>
pub fn get_testcase(&mut self) -> Result<Testcase>
Source§impl Tsffs
impl Tsffs
fn on_simulation_stopped_magic_start( &mut self, magic_number: MagicNumber, ) -> Result<()>
fn on_simulation_stopped_magic_assert(&mut self) -> Result<()>
fn finish_iteration( &mut self, exit_kind: ExitKind, iteration_count: IterationCount, snapshot_restore_mode: SnapshotRestoreMode, missing_start_info_message: &str, ) -> Result<IterationControl>
fn on_simulation_stopped_magic_stop(&mut self) -> Result<()>
fn on_simulation_stopped_with_magic( &mut self, magic_number: MagicNumber, ) -> Result<()>
fn on_simulation_stopped_with_manual_start( &mut self, processor: *mut ConfObject, info: ManualStartInfo, ) -> Result<()>
fn on_simulation_stopped_manual_start_without_buffer( &mut self, processor: *mut ConfObject, ) -> Result<()>
fn on_simulation_stopped_manual_stop(&mut self) -> Result<()>
fn on_simulation_stopped_solution(&mut self, kind: SolutionKind) -> Result<()>
fn on_simulation_stopped_with_reason( &mut self, reason: StopReason, ) -> Result<()>
fn on_simulation_stopped_without_reason(&mut self) -> Result<()>
Sourcepub fn on_simulation_stopped(&mut self) -> Result<()>
pub fn on_simulation_stopped(&mut self) -> Result<()>
Called on core simulation stopped HAP
Sourcepub fn on_exception(
&mut self,
obj: *mut ConfObject,
exception: i64,
) -> Result<()>
pub fn on_exception( &mut self, obj: *mut ConfObject, exception: i64, ) -> Result<()>
Called on core exception HAP. Check to see if this exception is configured as a solution or all exceptions are solutions and trigger a stop if so
Sourcepub fn on_breakpoint_memop(
&mut self,
obj: *mut ConfObject,
breakpoint: i64,
transaction: *mut GenericTransaction,
) -> Result<()>
pub fn on_breakpoint_memop( &mut self, obj: *mut ConfObject, breakpoint: i64, transaction: *mut GenericTransaction, ) -> Result<()>
Called on breakpoint memory operation HAP. Check to see if this breakpoint is configured as a solution or if all breakpoints are solutions and trigger a stop if so
Sourcepub fn on_magic_instruction(
&mut self,
trigger_obj: *mut ConfObject,
magic_number: MagicNumber,
) -> Result<()>
pub fn on_magic_instruction( &mut self, trigger_obj: *mut ConfObject, magic_number: MagicNumber, ) -> Result<()>
Check if magic instructions are set to trigger start and stop conditions, and trigger them if needed
pub fn on_control_register_write( &mut self, trigger_obj: *mut ConfObject, register_nr: i64, value: i64, ) -> Result<()>
Source§impl Tsffs
impl Tsffs
pub fn add_trace_processor(&mut self, cpu: *mut ConfObject) -> Result<()>
pub fn add_architecture_hint( &mut self, cpu: *mut ConfObject, hint: *mut c_char, ) -> Result<()>
Source§impl Tsffs
impl Tsffs
pub fn repro(&mut self, testcase_file: *mut c_char) -> Result<()>
pub fn start_with_buffer_ptr_size_ptr( &mut self, cpu: *mut ConfObject, buffer_address: GenericAddress, size_address: GenericAddress, virt: bool, ) -> Result<()>
pub fn start_with_buffer_ptr_size_value( &mut self, cpu: *mut ConfObject, testcase_address: GenericAddress, maximum_size: u32, virt: bool, ) -> Result<()>
pub fn start_with_buffer_ptr_size_ptr_value( &mut self, cpu: *mut ConfObject, buffer_address: GenericAddress, size_address: GenericAddress, maximum_size: u32, virt: bool, ) -> Result<()>
pub fn start_without_buffer( &mut self, cpu: *mut ConfObject, ) -> Result<AttrValue>
pub fn stop(&mut self) -> Result<()>
pub fn solution(&mut self, id: u64, message: *mut c_char) -> Result<()>
Source§impl Tsffs
impl Tsffs
fn record_branch(&mut self, pc: u64) -> Result<()>
fn attach_cached_callbacks( &mut self, cpu: *mut ConfObject, cached_handle: *mut cached_instruction_handle_t, handle: *mut instruction_handle_t, ) -> Result<()>
Sourcefn report_cached_feedback_error(&mut self, action: &str, error: &Error)
fn report_cached_feedback_error(&mut self, action: &str, error: &Error)
Report the first selective-instrumentation failure; later ones are silent to avoid flooding the log from a hot simulator callback.
fn trace_cached_comparison( &mut self, cpu: *mut ConfObject, decoded: &DecodedComparison, ) -> Result<()>
fn log_pc(&mut self, pc: u64) -> Result<()>
fn log_cmp( &mut self, pc: u64, types: Vec<CmpType>, cmp: CmpValues, ) -> Result<()>
Source§impl Tsffs
impl Tsffs
pub fn on_cached_instruction( &mut self, _obj: *mut ConfObject, cpu: *mut ConfObject, cached_handle: *mut cached_instruction_handle_t, handle: *mut instruction_handle_t, ) -> Result<()>
pub fn on_cached_branch_after( &mut self, _obj: *mut ConfObject, cpu: *mut ConfObject, _handle: *mut instruction_handle_t, ) -> Result<()>
pub fn on_instruction_after( &mut self, _obj: *mut ConfObject, cpu: *mut ConfObject, handle: *mut instruction_handle_t, ) -> Result<()>
pub fn on_instruction_before( &mut self, _obj: *mut ConfObject, cpu: *mut ConfObject, handle: *mut instruction_handle_t, ) -> Result<()>
Source§impl Tsffs
impl Tsffs
Sourcepub const COVERAGE_MAP_SIZE: usize
pub const COVERAGE_MAP_SIZE: usize
The size of the coverage map in bytes
Sourcepub const TIMEOUT_EVENT_NAME: &'static str = "detector_timeout_event"
pub const TIMEOUT_EVENT_NAME: &'static str = "detector_timeout_event"
The name of the registered timeout event
Sourcepub const SNAPSHOT_NAME: &'static str = "tsffs-origin-snapshot"
pub const SNAPSHOT_NAME: &'static str = "tsffs-origin-snapshot"
The name of the initial snapshot
Source§impl Tsffs
impl Tsffs
Sourcepub fn repro_restore_command() -> String
pub fn repro_restore_command() -> String
CLI command shown to the user to restore the origin state when stopped for repro. Simics 6 uses reverse-execution bookmarks; Simics 7 uses snapshots.
Source§impl Tsffs
Implementations for controlling the simulation
impl Tsffs
Implementations for controlling the simulation
Sourcepub fn stop_simulation(&mut self, reason: StopReason) -> Result<()>
pub fn stop_simulation(&mut self, reason: StopReason) -> Result<()>
Stop the simulation with a reason
Source§impl Tsffs
Implementations for common functionality
impl Tsffs
Implementations for common functionality
Sourcepub fn add_processor(
&mut self,
cpu: *mut ConfObject,
is_start: bool,
) -> Result<()>
pub fn add_processor( &mut self, cpu: *mut ConfObject, is_start: bool, ) -> Result<()>
Add a monitored processor to the simulation and whether the processor is the “start processor” which is the processor running when the fuzzing loop begins
Sourcepub(crate) fn saves_execution_traces(&self) -> bool
pub(crate) fn saves_execution_traces(&self) -> bool
Whether any execution-trace saving option is enabled.
Sourcepub(crate) fn full_instruction_features(&self) -> Vec<&'static str>
pub(crate) fn full_instruction_features(&self) -> Vec<&'static str>
Enabled features that need callbacks on every instruction.
Sourcepub(crate) fn instrument_processors(&mut self) -> Result<()>
pub(crate) fn instrument_processors(&mut self) -> Result<()>
Subscribe feedback callbacks on every tracked processor not yet instrumented. Called
when fuzzing starts (and for processors added afterwards). When
selective_instrumentation is enabled, x86-64 and i386 processors use cached-instruction
instrumentation unless a full-instruction feature is enabled or the CPU model lacks the
cached-instruction API; otherwise every processor uses per-instruction callbacks.
Sourcepub fn start_processor(&mut self) -> Option<&mut Architecture>
pub fn start_processor(&mut self) -> Option<&mut Architecture>
Return a reference to the saved “start processor” if there is one. There will be no “start processor” before a start harness (manual or magic) is executed.
Source§impl Tsffs
impl Tsffs
Sourcepub fn save_initial_snapshot(&mut self) -> Result<()>
pub fn save_initial_snapshot(&mut self) -> Result<()>
Save the initial snapshot using the configured method (either rev-exec micro checkpoints or snapshots)
Sourcepub fn restore_initial_snapshot(&mut self) -> Result<()>
pub fn restore_initial_snapshot(&mut self) -> Result<()>
Restore the initial snapshot using the configured method (either rev-exec micro checkpoints or snapshots)
Sourcepub fn should_restore_snapshot_this_iteration(&self) -> bool
pub fn should_restore_snapshot_this_iteration(&self) -> bool
Whether the initial snapshot should be restored at the current iteration boundary.
This is evaluated after self.iterations has been incremented.
Sourcepub fn have_initial_snapshot(&self) -> bool
pub fn have_initial_snapshot(&self) -> bool
Whether an initial snapshot has been saved
Sourcepub fn save_repro_bookmark_if_needed(&mut self) -> Result<()>
pub fn save_repro_bookmark_if_needed(&mut self) -> Result<()>
Save a repro bookmark if one is needed
Sourcepub fn should_auto_continue_repro(&self) -> bool
pub fn should_auto_continue_repro(&self) -> bool
Return true if TSFFS should continue simulation after preparing repro state.
Sourcepub fn continue_after_repro_prepared(&self) -> Result<()>
pub fn continue_after_repro_prepared(&self) -> Result<()>
Resume immediately after preparing repro state, or log that external resume is required.
Source§impl Tsffs
impl Tsffs
Sourcepub fn get_and_write_testcase(&mut self) -> Result<()>
pub fn get_and_write_testcase(&mut self) -> Result<()>
Get a testcase from the fuzzer and write it to memory along with, optionally, a size
Sourcepub fn post_timeout_event(&mut self) -> Result<()>
pub fn post_timeout_event(&mut self) -> Result<()>
Post a new timeout event on the start processor with the configured timeout in seconds
Sourcepub fn cancel_timeout_event(&mut self) -> Result<()>
pub fn cancel_timeout_event(&mut self) -> Result<()>
Cancel a pending timeout event, if there is one. Used when execution reaches a solution or normal stop condition before a timeout occurs.
pub fn save_symbolic_coverage(&mut self) -> Result<()>
Sourcepub fn save_execution_trace(&mut self) -> Result<()>
pub fn save_execution_trace(&mut self) -> Result<()>
Save the current execution trace to a file
Trait Implementations§
Source§impl AsConfObject for Tsffs
impl AsConfObject for Tsffs
§fn as_conf_object(&self) -> *const conf_object
fn as_conf_object(&self) -> *const conf_object
ConfObject pointer§fn as_conf_object_mut(&mut self) -> *mut conf_object
fn as_conf_object_mut(&mut self) -> *mut conf_object
ConfObject pointerimpl Class for Tsffs
Source§impl ClassInit for Tsffs
impl ClassInit for Tsffs
Source§unsafe fn init(instance: *mut ConfObject) -> Result<*mut ConfObject>
unsafe fn init(instance: *mut ConfObject) -> Result<*mut ConfObject>
Source§impl ClassObjectsFinalize for Tsffs
impl ClassObjectsFinalize for Tsffs
Source§unsafe fn objects_finalized(instance: *mut ConfObject) -> Result<()>
unsafe fn objects_finalized(instance: *mut ConfObject) -> Result<()>
Source§impl FromConfObject for Tsffs
impl FromConfObject for Tsffs
§unsafe fn from_conf_object<'a>(obj: *const conf_object) -> &'a Self
unsafe fn from_conf_object<'a>(obj: *const conf_object) -> &'a Self
ConfObject pointer Read more§unsafe fn from_conf_object_mut<'a>(obj: *mut conf_object) -> &'a mut Self
unsafe fn from_conf_object_mut<'a>(obj: *mut conf_object) -> &'a mut Self
ConfObject pointer Read moreimpl HasInterface<config> for Tsffs
impl HasInterface<fuzz> for Tsffs
Auto Trait Implementations§
impl !Freeze for Tsffs
impl !RefUnwindSafe for Tsffs
impl !Send for Tsffs
impl !Sync for Tsffs
impl !UnwindSafe for Tsffs
impl Forget for Tsffs
impl Move for Tsffs
impl Unpin for Tsffs
impl UnsafeUnpin for Tsffs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeHasClientPerfMonitor for T
impl<T> MaybeHasScalabilityMonitor for T
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<Tail, T> Prepend<T> for Tail
impl<Tail, T> Prepend<T> for Tail
§type PreprendResult = Tail
type PreprendResult = Tail
TupleList], of an [Prepend::prepend()] call,
including the prepended entry.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.