diff --git a/Cargo.toml b/Cargo.toml index 2a4ece4187..7f82cd0b1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,7 +84,7 @@ ahash = { version = "0.8.11", default-features = false } # The hash function alr 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.2" # bitfields, use this for bit fields and bit enums +bitbybit = "1.3.3" # 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 de35f6e1f3..b139ddb3a4 100644 --- a/libafl/src/observers/cmp.rs +++ b/libafl/src/observers/cmp.rs @@ -5,8 +5,6 @@ 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}; @@ -405,40 +403,47 @@ impl AFLppCmpValuesMetadata { } } -/// 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 - /// - /// 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 +#[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. /// - /// 2: cmp, rtn - #[bit(11, r)] - type_: u1, - /// OR-ed bitflags describing whether the comparison is <, >, =, <=, >=, or transform + /// # Bitfields /// - /// 16 types for arithmetic comparison types - #[bits(12..=15, r)] - attribute: u4, + /// - 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, + } } +pub use aflpp_cmplog_header::AFLppCmpLogHeader; diff --git a/libafl_intelpt/src/lib.rs b/libafl_intelpt/src/lib.rs index 0530aa33fc..c2ab683858 100644 --- a/libafl_intelpt/src/lib.rs +++ b/libafl_intelpt/src/lib.rs @@ -695,6 +695,7 @@ 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 {