add cmplog_cores command line argument support
This commit is contained in:
parent
b8e4f4c6fa
commit
ed26319a21
@ -17,7 +17,7 @@ pub mod cmplog_rt;
|
|||||||
/// The `LibAFL` firda helper
|
/// The `LibAFL` firda helper
|
||||||
pub mod helper;
|
pub mod helper;
|
||||||
|
|
||||||
// for parsing asan cores
|
// for parsing asan and cmplog cores
|
||||||
use libafl::bolts::os::parse_core_bind_arg;
|
use libafl::bolts::os::parse_core_bind_arg;
|
||||||
// for getting current core_id
|
// for getting current core_id
|
||||||
use core_affinity::get_core_ids;
|
use core_affinity::get_core_ids;
|
||||||
@ -47,6 +47,7 @@ impl FridaOptions {
|
|||||||
pub fn parse_env_options() -> Self {
|
pub fn parse_env_options() -> Self {
|
||||||
let mut options = Self::default();
|
let mut options = Self::default();
|
||||||
let mut asan_cores = None;
|
let mut asan_cores = None;
|
||||||
|
let mut cmplog_cores = None;
|
||||||
|
|
||||||
if let Ok(env_options) = std::env::var("LIBAFL_FRIDA_OPTIONS") {
|
if let Ok(env_options) = std::env::var("LIBAFL_FRIDA_OPTIONS") {
|
||||||
for option in env_options.trim().split(':') {
|
for option in env_options.trim().split(':') {
|
||||||
@ -108,10 +109,21 @@ impl FridaOptions {
|
|||||||
}
|
}
|
||||||
"cmplog" => {
|
"cmplog" => {
|
||||||
options.enable_cmplog = value.parse().unwrap();
|
options.enable_cmplog = value.parse().unwrap();
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "aarch64"))]
|
||||||
|
if options.enable_cmplog {
|
||||||
|
panic!(
|
||||||
|
"cmplog is not currently supported on targets other than aarch64"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if !cfg!(feature = "cmplog") && options.enable_cmplog {
|
if !cfg!(feature = "cmplog") && options.enable_cmplog {
|
||||||
panic!("cmplog feature is disabled!")
|
panic!("cmplog feature is disabled!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"cmplog_cores" => {
|
||||||
|
cmplog_cores = parse_core_bind_arg(value);
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
panic!("unknown FRIDA option: '{}'", option);
|
panic!("unknown FRIDA option: '{}'", option);
|
||||||
}
|
}
|
||||||
@ -124,14 +136,25 @@ impl FridaOptions {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
core_ids.len(),
|
core_ids.len(),
|
||||||
1,
|
1,
|
||||||
"Client should only be enabled on one core"
|
"[asan_cores] Client should only be enabled on one core"
|
||||||
);
|
);
|
||||||
let core_id = core_ids[0].id;
|
let core_id = core_ids[0].id;
|
||||||
options.enable_asan = asan_cores.contains(&core_id);
|
options.enable_asan = asan_cores.contains(&core_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if options.enable_cmplog {
|
||||||
|
if let Some(cmplog_cores) = cmplog_cores {
|
||||||
|
let core_ids = get_core_ids().unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
core_ids.len(),
|
||||||
|
1,
|
||||||
|
"[cmplog_cores] Client should only be enabled on one core"
|
||||||
|
);
|
||||||
|
let core_id = core_ids[0].id;
|
||||||
|
options.enable_cmplog = cmplog_cores.contains(&core_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
options
|
options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user