From b3020d729643a37d878ab74647fa7446d9b34069 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Sat, 25 Feb 2023 00:16:37 +0100 Subject: [PATCH] Fix CoreId for Frida, FreeBSD (#1100) --- libafl/src/bolts/cli.rs | 2 +- libafl/src/bolts/core_affinity.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libafl/src/bolts/cli.rs b/libafl/src/bolts/cli.rs index 8b3885311b..d9855c9428 100644 --- a/libafl/src/bolts/cli.rs +++ b/libafl/src/bolts/cli.rs @@ -137,7 +137,7 @@ pub struct FuzzerOptions { /// cores. 'none' to run a client without binding to any core. /// ex: '1,2-4,6' selects the cores 1, 2, 3, 4, and 6. #[cfg(feature = "frida_cli")] - #[arg(long, default_value = "0", value_parser = Cores::from_cmdline, help_heading = "ASAN Options")] + #[arg(long, default_value = "0", value_parser = Cores::from_cmdline, help_heading = "Cores that should use ASAN")] pub asan_cores: Cores, /// number of fuzz iterations to perform diff --git a/libafl/src/bolts/core_affinity.rs b/libafl/src/bolts/core_affinity.rs index 35aff72126..4e129fc7e5 100644 --- a/libafl/src/bolts/core_affinity.rs +++ b/libafl/src/bolts/core_affinity.rs @@ -158,8 +158,7 @@ impl Cores { /// Checks if this [`Cores`] instance contains a given ``core_id`` #[must_use] - pub fn contains(&self, core_id: usize) -> bool { - let core_id = CoreId::from(core_id); + pub fn contains(&self, core_id: CoreId) -> bool { self.ids.contains(&core_id) } @@ -740,7 +739,7 @@ mod freebsd { // Ensure that the system pinned the current thread // to the specified core. let mut core_mask = new_cpuset(); - unsafe { CPU_SET(ids[0].id, &mut core_mask) }; + unsafe { CPU_SET(ids[0].0, &mut core_mask) }; let new_mask = get_affinity_mask().unwrap();