Skip to content

Commit

Permalink
#silifuzz Add code to support expensive instruction limit in fix tool.
Browse files Browse the repository at this point in the history
By default we do not limit the count of expensive instructions in snapshots.

PiperOrigin-RevId: 632327574
  • Loading branch information
dougkwan authored and copybara-github committed May 10, 2024
1 parent 8fa86c9 commit 56d4680
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tool_libs/fix_tool_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ absl::StatusOr<Snapshot> RemakeAndVerify(const Snapshot& snapshot,
config.trace.x86_filter_vsyscall_region_access =
options.x86_filter_vsyscall_region_access;
config.trace.filter_memory_access = options.filter_memory_access;
config.trace.expensive_instruction_count_limit =
options.expensive_instruction_count_limit;
config.enforce_fuzzing_config = options.enforce_fuzzing_config;

return MakeSnapshot(snapshot, config);
Expand Down
8 changes: 8 additions & 0 deletions tool_libs/fix_tool_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ struct FixupSnapshotOptions {
// If true, enforce fuzzing config. Snapshot with non-conforming memory
// mappings are filtered.
bool enforce_fuzzing_config = true;

// Limit of number of expensive instructions executed in a snapshot.
// If it is 0, no limit is enforced. Otherwise, a snapshot is filtered if
// number of expensive instructions reaches this limit. A value of 1 means
// no expensive instructions are allowed. Currently, only some x86
// instructions are considered expensive. Setting this on non-x86 platforms
// has no effect.
int expensive_instruction_count_limit = 0;
};

// Fixes up `input` and updates fix tool statistics in `*counters`.
Expand Down

0 comments on commit 56d4680

Please sign in to comment.