Skip to content

Commit 4083f0b

Browse files
authored
Fix drcov path parsing (#2884)
* fix drcov path parsing * refactoring of drcov tool * add the possibility to sort addresses in drcov tools * more aggressive clippy. it now catches more warnings as errors than before * reduce the number of unfixable warnings displayed.
1 parent c5b7c7c commit 4083f0b

File tree

27 files changed

+418
-275
lines changed

27 files changed

+418
-275
lines changed

Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,15 @@ z3 = "0.12.1"
126126

127127

128128
[workspace.lints.rust]
129+
# Deny
130+
warnings = { level = "deny", priority = -1 }
131+
129132
# Forbid
130133
unexpected_cfgs = "forbid"
131134

132135
# Allow
133136
incomplete_features = "allow"
134-
ambiguous_glob_reexports = "allow"
137+
# ambiguous_glob_reexports = "allow"
135138

136139

137140
[workspace.lints.clippy]
@@ -142,9 +145,10 @@ cargo_common_metadata = "deny"
142145

143146
# Warn
144147
cargo = { level = "warn", priority = -1 }
145-
negative_feature_names = "warn"
146148

147149
# Allow
150+
negative_feature_names = "allow" # TODO: turn into 'warn' when working
151+
multiple_crate_versions = "allow" # TODO: turn into `warn` when working
148152
unreadable_literal = "allow"
149153
type_repetition_in_bounds = "allow"
150154
missing_errors_doc = "allow"

bindings/pylibafl/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,7 @@ pyo3-build-config = { workspace = true }
3030
name = "pylibafl"
3131
crate-type = ["cdylib"]
3232

33-
[profile.dev]
34-
panic = "abort"
33+
# TODO: find a way to fix this when a solution is found
34+
# https://github.com/rust-lang/cargo/issues/9330
35+
# [profile.dev]
36+
# panic = "abort"

fuzzers/binary_only/qemu_coverage/Makefile.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ windows_alias = "unsupported"
244244
command = "${TARGET_DIR}/${PROFILE_DIR}/qemu_coverage-${CARGO_MAKE_PROFILE}"
245245
args = [
246246
"--coverage-path",
247-
"${TARGET_DIR}/drcov.log",
247+
"${TARGET_DIR}/cov.drcov",
248248
"--input-dir",
249249
"./corpus",
250250
"--",
@@ -294,11 +294,11 @@ script = '''
294294
cargo make ${FEATURE} || exit 1
295295
296296
cargo run --manifest-path ../../../utils/drcov_utils/Cargo.toml --bin drcov_merge -- \
297-
-i ${TARGET_DIR}/drcov-000.log ${TARGET_DIR}/drcov-001.log ${TARGET_DIR}/drcov-002.log ${TARGET_DIR}/drcov-003.log \
298-
--output ${TARGET_DIR}/drcov-merged.log || exit 1
297+
-i ${TARGET_DIR}/cov-000.drcov ${TARGET_DIR}/cov-001.drcov ${TARGET_DIR}/cov-002.drcov ${TARGET_DIR}/cov-003.drcov \
298+
--output ${TARGET_DIR}/cov-merged.drcov || exit 1
299299
300300
TMP=$(cargo run --manifest-path ../../../utils/drcov_utils/Cargo.toml --bin drcov_dump_addrs -- \
301-
-i ${TARGET_DIR}/drcov-merged.log | wc -l || exit 1)
301+
-i ${TARGET_DIR}/cov-merged.drcov -a | wc -l || exit 1)
302302
303303
NB_BLOCKS=$((TMP - 1))
304304

fuzzers/binary_only/qemu_coverage/src/fuzzer.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,7 @@ pub fn fuzz() {
135135
cov_path.set_file_name(format!("{coverage_name}-{core:03}.{coverage_extension}"));
136136

137137
let emulator_modules = tuple_list!(
138-
DrCovModule::builder()
139-
.filename(cov_path.clone())
140-
.full_trace(false)
141-
.build(),
138+
DrCovModule::builder().filename(cov_path.clone()).build(),
142139
SnapshotModule::new()
143140
);
144141

libafl/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ pub use libafl_bolts::{nonzero, Error};
8686
/// The purpose of this module is to alleviate imports of many components by adding a glob import.
8787
#[cfg(feature = "prelude")]
8888
pub mod prelude {
89+
#![expect(ambiguous_glob_reexports)]
90+
8991
pub use super::{
9092
corpus::*, events::*, executors::*, feedbacks::*, fuzzer::*, generators::*, inputs::*,
9193
monitors::*, mutators::*, observers::*, schedulers::*, stages::*, state::*, *,

libafl_bolts/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,8 @@ impl From<pyo3::PyErr> for Error {
678678
/// The purpose of this module is to alleviate imports of many components by adding a glob import.
679679
#[cfg(feature = "prelude")]
680680
pub mod prelude {
681+
#![allow(ambiguous_glob_reexports)]
682+
681683
pub use super::{bolts_prelude::*, *};
682684
}
683685

libafl_bolts/src/tuples.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33
#[cfg(feature = "alloc")]
44
use alloc::{borrow::Cow, vec::Vec};
55
#[cfg(feature = "alloc")]
6-
use core::ops::{Deref, DerefMut};
76
use core::{
8-
any::{type_name, TypeId},
9-
cell::Cell,
7+
any::type_name,
108
fmt::{Debug, Formatter},
11-
marker::PhantomData,
12-
mem::transmute,
13-
ops::{Index, IndexMut},
9+
ops::{Deref, DerefMut, Index, IndexMut},
1410
};
11+
use core::{any::TypeId, cell::Cell, marker::PhantomData, mem::transmute};
1512

1613
#[cfg(feature = "alloc")]
1714
use serde::{Deserialize, Serialize};

libafl_cc/build.rs

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
use std::{
2-
env,
3-
fs::File,
4-
io::Write,
5-
path::{Path, PathBuf},
6-
process::Command,
7-
str,
8-
};
1+
#[cfg(any(
2+
target_vendor = "apple",
3+
feature = "ddg-instr",
4+
feature = "function-logging",
5+
feature = "cmplog-routines",
6+
feature = "autotokens",
7+
feature = "coverage-accounting",
8+
feature = "cmplog-instructions",
9+
feature = "ctx",
10+
feature = "dump-cfg",
11+
feature = "profiling",
12+
))]
13+
use std::path::PathBuf;
14+
use std::{env, fs::File, io::Write, path::Path, process::Command, str};
915

1016
#[cfg(target_vendor = "apple")]
1117
use glob::glob;
@@ -20,6 +26,17 @@ const LLVM_VERSION_MAX: u32 = 33;
2026
const LLVM_VERSION_MIN: u32 = 6;
2127

2228
/// Get the extension for a shared object
29+
#[cfg(any(
30+
feature = "ddg-instr",
31+
feature = "function-logging",
32+
feature = "cmplog-routines",
33+
feature = "autotokens",
34+
feature = "coverage-accounting",
35+
feature = "cmplog-instructions",
36+
feature = "ctx",
37+
feature = "dump-cfg",
38+
feature = "profiling",
39+
))]
2340
fn dll_extension<'a>() -> &'a str {
2441
if let Ok(vendor) = env::var("CARGO_CFG_TARGET_VENDOR") {
2542
if vendor == "apple" {
@@ -143,6 +160,17 @@ fn find_llvm_version() -> Option<i32> {
143160
None
144161
}
145162

163+
#[cfg(any(
164+
feature = "ddg-instr",
165+
feature = "function-logging",
166+
feature = "cmplog-routines",
167+
feature = "autotokens",
168+
feature = "coverage-accounting",
169+
feature = "cmplog-instructions",
170+
feature = "ctx",
171+
feature = "dump-cfg",
172+
feature = "profiling",
173+
))]
146174
#[expect(clippy::too_many_arguments)]
147175
fn build_pass(
148176
bindir_path: &Path,

libafl_concolic/symcc_runtime/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ pub mod cpp_runtime {
4040
#![allow(non_upper_case_globals)]
4141
#![allow(non_camel_case_types)]
4242
#![allow(non_snake_case)]
43+
#![allow(unused_attributes)]
44+
4345
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
4446
}
4547

libafl_concolic/symcc_runtime/src/tracing.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Tracing of expressions in a serialized form.
2+
#![allow(no_mangle_generic_items)]
23

34
pub use libafl::observers::concolic::serialization_format::StdShMemMessageFileWriter;
45
use libafl::observers::concolic::SymExpr;

0 commit comments

Comments
 (0)