Frida: Make stalker.exclude() configurable from command line arguments (#956)

* remove exclude on windows

* linux x86_64

* option
This commit is contained in:
Dongjia "toka" Zhang 2022-12-21 19:23:57 +09:00 committed by GitHub
parent 4d8b566a87
commit d77d9d5f31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -236,6 +236,13 @@ pub struct FuzzerOptions {
#[arg(long, help_heading = "Frida Options")] #[arg(long, help_heading = "Frida Options")]
pub drcov: bool, pub drcov: bool,
/// disable stalker.exclude() if true
/// It's better to disable this on windows or your harness uses c++ exception handling
/// See https://github.com/AFLplusplus/LibAFL/issues/830
#[cfg(feature = "frida_cli")]
#[arg(long, help_heading = "Frida Options")]
pub disable_excludes: bool,
/// locations which will not be instrumented for ASAN or coverage purposes (ex: mod_name@0x12345) /// locations which will not be instrumented for ASAN or coverage purposes (ex: mod_name@0x12345)
#[cfg(feature = "frida_cli")] #[cfg(feature = "frida_cli")]
#[arg(short = 'D', long, help_heading = "Frida Options", value_parser = parse_instrumentation_location)] #[arg(short = 'D', long, help_heading = "Frida Options", value_parser = parse_instrumentation_location)]

View File

@ -172,6 +172,8 @@ where
break; break;
} }
} }
if !helper.options().disable_excludes {
for range in ranges.gaps(&(0..usize::MAX)) { for range in ranges.gaps(&(0..usize::MAX)) {
println!("excluding range: {:x}-{:x}", range.start, range.end); println!("excluding range: {:x}-{:x}", range.start, range.end);
stalker.exclude(&MemoryRange::new( stalker.exclude(&MemoryRange::new(
@ -179,6 +181,7 @@ where
range.end - range.start, range.end - range.start,
)); ));
} }
}
#[cfg(windows)] #[cfg(windows)]
initialize(&gum); initialize(&gum);