From b7c7465be46890c7091cdbe5911f0d3d775dd72b Mon Sep 17 00:00:00 2001 From: "Marco C." <46560192+Marcondiro@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:37:31 +0100 Subject: [PATCH 1/2] Revert #2768 fix bitbybit CI by locking bitbybit <1.3.3 (#2772) * lock bitbybit < 1.3.3 and revert #2768 * lock to 1.3.2 --- Cargo.toml | 8 ++-- libafl/src/observers/cmp.rs | 77 +++++++++++++++++-------------------- libafl_intelpt/src/lib.rs | 1 - 3 files changed, 41 insertions(+), 45 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7f82cd0b1c..335e8eb66b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,11 +80,13 @@ libafl_benches = { path = "./utils/libafl_benches", version = "0.14.1", default- libafl_jumper = { path = "./utils/libafl_jumper", version = "0.14.1", default-features = false } # External deps -ahash = { version = "0.8.11", default-features = false } # The hash function already used in hashbrown -arbitrary-int = "1.2.7" # arbitrary sized integers, useful in combination with bitfields (bitbybit crate) +ahash = { version = "0.8.11", default-features = false } # The hash function already used in hashbrown +arbitrary-int = "1.2.7" # arbitrary sized integers, useful in combination with bitfields (bitbybit crate) backtrace = { version = "0.3.74", default-features = false } # Used to get the stacktrace in StacktraceObserver bindgen = "0.71.1" -bitbybit = "1.3.3" # bitfields, use this for bit fields and bit enums +# 2024-12-16: bitbybit 1.3.3 is leading CI to fail due to missing docs. +# fixme: Change this to 1.3.3 when the issue https://github.com/danlehmann/bitfield/issues/66 is resolved. +bitbybit = "=1.3.2" # bitfields, use this for bit fields and bit enums clap = "4.5.18" cc = "1.1.21" cmake = "0.1.51" diff --git a/libafl/src/observers/cmp.rs b/libafl/src/observers/cmp.rs index b139ddb3a4..de35f6e1f3 100644 --- a/libafl/src/observers/cmp.rs +++ b/libafl/src/observers/cmp.rs @@ -5,6 +5,8 @@ use core::{ ops::{Deref, DerefMut}, }; +use arbitrary_int::{u1, u4, u5, u6}; +use bitbybit::bitfield; use hashbrown::HashMap; use libafl_bolts::{ownedref::OwnedRefMut, AsSlice, HasLen, Named}; use serde::{Deserialize, Serialize}; @@ -403,47 +405,40 @@ impl AFLppCmpValuesMetadata { } } -#[allow(missing_docs)] // 2024-12-15: bitfield is leading CI to fail due to missing docs. -mod aflpp_cmplog_header { - use arbitrary_int::{u1, u4, u5, u6}; - use bitbybit::bitfield; - - /// Comparison header, used to describe a set of comparison values efficiently. +/// Comparison header, used to describe a set of comparison values efficiently. +/// +/// # Bitfields +/// +/// - hits: The number of hits of a particular comparison +/// - id: Unused by ``LibAFL``, a unique ID for a particular comparison +/// - shape: Whether a comparison is u8/u8, u16/u16, etc. +/// - type_: Whether the comparison value represents an instruction (like a `cmp`) or function +/// call arguments +/// - attribute: OR-ed bitflags describing whether the comparison is <, >, =, <=, >=, or transform +/// - overflow: Whether the comparison overflows +/// - reserved: Reserved for future use +#[bitfield(u16)] +#[derive(Debug)] +pub struct AFLppCmpLogHeader { + /// The number of hits of a particular comparison /// - /// # Bitfields + /// 6 bits up to 63 entries, we have CMP_MAP_H = 32 (so using half of it) + #[bits(0..=5, r)] + hits: u6, + /// Whether a comparison is u8/u8, u16/u16, etc. /// - /// - hits: The number of hits of a particular comparison - /// - id: Unused by ``LibAFL``, a unique ID for a particular comparison - /// - shape: Whether a comparison is u8/u8, u16/u16, etc. - /// - type_: Whether the comparison value represents an instruction (like a `cmp`) or function - /// call arguments - /// - attribute: OR-ed bitflags describing whether the comparison is <, >, =, <=, >=, or transform - /// - overflow: Whether the comparison overflows - /// - reserved: Reserved for future use - #[bitfield(u16)] - #[derive(Debug)] - pub struct AFLppCmpLogHeader { - /// The number of hits of a particular comparison - /// - /// 6 bits up to 63 entries, we have CMP_MAP_H = 32 (so using half of it) - #[bits(0..=5, r)] - hits: u6, - /// Whether a comparison is u8/u8, u16/u16, etc. - /// - /// 31 + 1 bytes max - #[bits(6..=10, r)] - shape: u5, - /// Whether the comparison value represents an instruction (like a `cmp`) or function call - /// arguments - /// - /// 2: cmp, rtn - #[bit(11, r)] - type_: u1, - /// OR-ed bitflags describing whether the comparison is <, >, =, <=, >=, or transform - /// - /// 16 types for arithmetic comparison types - #[bits(12..=15, r)] - attribute: u4, - } + /// 31 + 1 bytes max + #[bits(6..=10, r)] + shape: u5, + /// Whether the comparison value represents an instruction (like a `cmp`) or function call + /// arguments + /// + /// 2: cmp, rtn + #[bit(11, r)] + type_: u1, + /// OR-ed bitflags describing whether the comparison is <, >, =, <=, >=, or transform + /// + /// 16 types for arithmetic comparison types + #[bits(12..=15, r)] + attribute: u4, } -pub use aflpp_cmplog_header::AFLppCmpLogHeader; diff --git a/libafl_intelpt/src/lib.rs b/libafl_intelpt/src/lib.rs index c2ab683858..0530aa33fc 100644 --- a/libafl_intelpt/src/lib.rs +++ b/libafl_intelpt/src/lib.rs @@ -695,7 +695,6 @@ impl IntelPTBuilder { /// Perf event config for `IntelPT` /// /// (This is almost mapped to `IA32_RTIT_CTL MSR` by perf) -#[allow(missing_docs)] // 2024-12-15: bitfield is leading CI to fail due to missing docs. #[cfg(target_os = "linux")] #[bitfield(u64, default = 0)] struct PtConfig { From d9ddf82499df8074865ab4d3820095b1c2604a78 Mon Sep 17 00:00:00 2001 From: Mrmaxmeier <3913977+Mrmaxmeier@users.noreply.github.com> Date: Tue, 17 Dec 2024 21:08:32 +0100 Subject: [PATCH 2/2] libafl_{cc,derive}: Bump MSRV to 1.82 for `home` crate update (#2775) * libafl_{cc,derive}: Bump MSRV for `home` crate update With the upcoming 2024 edition we should also set `resolver = "3"` in the workspace's Cargo.toml to opt into a new MSRV-aware dependency resolver. This would fix the breakage we encountered with dependencies that bump their MSRV in a minor version update. * libafl_cc: apply clippy suggestion --- libafl_cc/Cargo.toml | 2 +- libafl_cc/src/cfg.rs | 2 +- libafl_derive/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libafl_cc/Cargo.toml b/libafl_cc/Cargo.toml index 5c89b8c39d..6974aeddcf 100644 --- a/libafl_cc/Cargo.toml +++ b/libafl_cc/Cargo.toml @@ -9,7 +9,7 @@ readme = "README.md" license = "MIT OR Apache-2.0" keywords = ["fuzzing", "testing", "compiler"] edition = "2021" -rust-version = "1.78" +rust-version = "1.82" categories = [ "development-tools::testing", "emulators", diff --git a/libafl_cc/src/cfg.rs b/libafl_cc/src/cfg.rs index 0551bb8b97..49789f3c5c 100644 --- a/libafl_cc/src/cfg.rs +++ b/libafl_cc/src/cfg.rs @@ -317,7 +317,7 @@ where let new_distance = distance + successor_info.get_weight(); let is_shorter = distances .get(successor) - .map_or(true, |¤t| new_distance < current); + .is_none_or(|¤t| new_distance < current); if is_shorter { distances.insert(*successor, new_distance); diff --git a/libafl_derive/Cargo.toml b/libafl_derive/Cargo.toml index 2cc461b66c..cd2d76a61b 100644 --- a/libafl_derive/Cargo.toml +++ b/libafl_derive/Cargo.toml @@ -9,7 +9,7 @@ readme = "../README.md" license = "MIT OR Apache-2.0" keywords = ["fuzzing", "testing"] edition = "2021" -rust-version = "1.78" +rust-version = "1.82" categories = [ "development-tools::testing", "emulators",