Skip to content

Commit

Permalink
lock bitbybit < 1.3.3 and revert AFLplusplus#2768
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcondiro committed Dec 16, 2024
1 parent 61e3f0b commit e6ebbf9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 45 deletions.
8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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, < 1.3.3" # bitfields, use this for bit fields and bit enums
clap = "4.5.18"
cc = "1.1.21"
cmake = "0.1.51"
Expand Down
77 changes: 36 additions & 41 deletions libafl/src/observers/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
1 change: 0 additions & 1 deletion libafl_intelpt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e6ebbf9

Please sign in to comment.