From 11b63b6318e345b0da9c0215c66c87f4fd9dbeb1 Mon Sep 17 00:00:00 2001 From: toka Date: Mon, 6 Nov 2023 13:34:36 +0100 Subject: [PATCH 1/4] fix --- libafl_cc/src/dump-cfg-pass.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libafl_cc/src/dump-cfg-pass.cc b/libafl_cc/src/dump-cfg-pass.cc index f045632b64..01daa24303 100644 --- a/libafl_cc/src/dump-cfg-pass.cc +++ b/libafl_cc/src/dump-cfg-pass.cc @@ -43,9 +43,9 @@ #include "llvm/IR/PassManager.h" #else #include "llvm/IR/LegacyPassManager.h" + #include "llvm/Transforms/IPO/PassManagerBuilder.h" #endif -#include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/Module.h" #include "llvm/IR/DebugInfo.h" @@ -53,7 +53,6 @@ #include "llvm/IR/Verifier.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/ValueTracking.h" From c03d731463260fcab18d69174a0dc170bb43c5be Mon Sep 17 00:00:00 2001 From: "Dongjia \"toka\" Zhang" Date: Tue, 7 Nov 2023 15:25:04 +0100 Subject: [PATCH 2/4] fix --- .github/workflows/build_and_test.yml | 2 ++ fuzzers/libfuzzer_stb_image/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 29fda2c9ab..762afa1c74 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -365,6 +365,8 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 - name: install cxx bridge run: cargo install cxxbridge-cmd + - name: Build fuzzers/libfuzzer_stb_image + run: cd fuzzers/libfuzzer_stb_image && cargo build --release - name: Build fuzzers/frida_libpng run: cd fuzzers/frida_libpng/ && cargo make test - name: Build fuzzers/frida_gdiplus diff --git a/fuzzers/libfuzzer_stb_image/Cargo.toml b/fuzzers/libfuzzer_stb_image/Cargo.toml index a0c1233f37..5c77cdd2c4 100644 --- a/fuzzers/libfuzzer_stb_image/Cargo.toml +++ b/fuzzers/libfuzzer_stb_image/Cargo.toml @@ -18,7 +18,7 @@ debug = true [dependencies] libafl = { path = "../../libafl/" } libafl_bolts = { path = "../../libafl_bolts/" } -libafl_targets = { path = "../../libafl_targets/", features = ["sancov_pcguard_edges", "sancov_cmplog", "libfuzzer"] } +libafl_targets = { path = "../../libafl_targets/", features = ["sancov_pcguard_edges", "sancov_cmplog", "libfuzzer", "libfuzzer_no_link_main"] } mimalloc = { version = "*", default-features = false } [build-dependencies] From f1613bb4e4bfa5eefb244a6525b222d12391937d Mon Sep 17 00:00:00 2001 From: toka Date: Wed, 8 Nov 2023 14:21:14 +0100 Subject: [PATCH 3/4] HOW DO I ADD FROM:FROM???? --- libafl/src/corpus/cached.rs | 1 + libafl/src/corpus/inmemory.rs | 1 + libafl/src/corpus/inmemory_ondisk.rs | 1 + libafl/src/corpus/ondisk.rs | 1 + libafl/src/events/simple.rs | 1 + libafl/src/executors/inprocess.rs | 1 + libafl/src/feedbacks/mod.rs | 1 + libafl/src/generators/mod.rs | 1 + libafl/src/monitors/mod.rs | 5 +++-- libafl/src/mutators/scheduled.rs | 1 + libafl/src/stages/mutational.rs | 1 + libafl_bolts/src/os/unix_shmem_server.rs | 2 +- libafl_bolts/src/rands.rs | 1 + 13 files changed, 15 insertions(+), 3 deletions(-) diff --git a/libafl/src/corpus/cached.rs b/libafl/src/corpus/cached.rs index c960a58a23..812e1bb36c 100644 --- a/libafl/src/corpus/cached.rs +++ b/libafl/src/corpus/cached.rs @@ -251,6 +251,7 @@ where /// ``CachedOnDiskCorpus`` Python bindings #[cfg(feature = "python")] +#[allow(clippy::unnecessary_fallible_conversions)] pub mod pybind { use alloc::string::String; use std::path::PathBuf; diff --git a/libafl/src/corpus/inmemory.rs b/libafl/src/corpus/inmemory.rs index 2016583cb2..25781fd4b6 100644 --- a/libafl/src/corpus/inmemory.rs +++ b/libafl/src/corpus/inmemory.rs @@ -429,6 +429,7 @@ where /// `InMemoryCorpus` Python bindings #[cfg(feature = "python")] +#[allow(clippy::unnecessary_fallible_conversions)] pub mod pybind { use pyo3::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/libafl/src/corpus/inmemory_ondisk.rs b/libafl/src/corpus/inmemory_ondisk.rs index 73a28b4846..3d06f34c74 100644 --- a/libafl/src/corpus/inmemory_ondisk.rs +++ b/libafl/src/corpus/inmemory_ondisk.rs @@ -439,6 +439,7 @@ where } #[cfg(feature = "python")] +#[allow(clippy::unnecessary_fallible_conversions)] /// `InMemoryOnDiskCorpus` Python bindings pub mod pybind { use alloc::string::String; diff --git a/libafl/src/corpus/ondisk.rs b/libafl/src/corpus/ondisk.rs index e7b7cccada..b7beeef1e4 100644 --- a/libafl/src/corpus/ondisk.rs +++ b/libafl/src/corpus/ondisk.rs @@ -262,6 +262,7 @@ where } #[cfg(feature = "python")] +#[allow(clippy::unnecessary_fallible_conversions)] /// `OnDiskCorpus` Python bindings pub mod pybind { use alloc::string::String; diff --git a/libafl/src/events/simple.rs b/libafl/src/events/simple.rs index 76f7eef05e..bf98aae22c 100644 --- a/libafl/src/events/simple.rs +++ b/libafl/src/events/simple.rs @@ -579,6 +579,7 @@ where /// `SimpleEventManager` Python bindings #[cfg(feature = "python")] #[allow(missing_docs)] +#[allow(clippy::unnecessary_fallible_conversions)] pub mod pybind { use pyo3::prelude::*; diff --git a/libafl/src/executors/inprocess.rs b/libafl/src/executors/inprocess.rs index 9d22ccf3b3..c527dad525 100644 --- a/libafl/src/executors/inprocess.rs +++ b/libafl/src/executors/inprocess.rs @@ -2214,6 +2214,7 @@ mod tests { #[cfg(feature = "python")] #[allow(missing_docs)] +#[allow(clippy::unnecessary_fallible_conversions)] /// `InProcess` Python bindings pub mod pybind { use alloc::boxed::Box; diff --git a/libafl/src/feedbacks/mod.rs b/libafl/src/feedbacks/mod.rs index a32f815496..ef81837bc8 100644 --- a/libafl/src/feedbacks/mod.rs +++ b/libafl/src/feedbacks/mod.rs @@ -1095,6 +1095,7 @@ impl From for ConstFeedback { /// `Feedback` Python bindings #[cfg(feature = "python")] +#[allow(clippy::unnecessary_fallible_conversions)] #[allow(missing_docs)] pub mod pybind { use std::cell::UnsafeCell; diff --git a/libafl/src/generators/mod.rs b/libafl/src/generators/mod.rs index a2fbbca66f..82cb0d6d4a 100644 --- a/libafl/src/generators/mod.rs +++ b/libafl/src/generators/mod.rs @@ -170,6 +170,7 @@ where /// `Generator` Python bindings #[allow(missing_docs)] #[cfg(feature = "python")] +#[allow(clippy::unnecessary_fallible_conversions)] pub mod pybind { use alloc::vec::Vec; diff --git a/libafl/src/monitors/mod.rs b/libafl/src/monitors/mod.rs index e1f200d78a..74724c5c68 100644 --- a/libafl/src/monitors/mod.rs +++ b/libafl/src/monitors/mod.rs @@ -847,10 +847,10 @@ impl ClientPerfMonitor { /// Update the given [`PerfFeature`] with the given `time` pub fn update_feature(&mut self, feature: PerfFeature, time: u64) { // Get the current stage index as `usize` - let stage_index: usize = self.curr_stage.try_into().unwrap(); + let stage_index: usize = self.curr_stage.into(); // Get the index of the given feature - let feature_index: usize = feature.try_into().unwrap(); + let feature_index: usize = feature.into(); if stage_index >= self.stages.len() { self.stages @@ -984,6 +984,7 @@ impl Default for ClientPerfMonitor { } /// `Monitor` Python bindings #[cfg(feature = "python")] +#[allow(clippy::unnecessary_fallible_conversions)] #[allow(missing_docs)] pub mod pybind { use alloc::{boxed::Box, string::String, vec::Vec}; diff --git a/libafl/src/mutators/scheduled.rs b/libafl/src/mutators/scheduled.rs index be6d9f1783..513bf3f07b 100644 --- a/libafl/src/mutators/scheduled.rs +++ b/libafl/src/mutators/scheduled.rs @@ -603,6 +603,7 @@ mod tests { /// `SchedulerMutator` Python bindings #[cfg(feature = "python")] #[allow(missing_docs)] +#[allow(clippy::unnecessary_fallible_conversions)] pub mod pybind { use pyo3::prelude::*; diff --git a/libafl/src/stages/mutational.rs b/libafl/src/stages/mutational.rs index 8f3650ea2c..8d34bdd02d 100644 --- a/libafl/src/stages/mutational.rs +++ b/libafl/src/stages/mutational.rs @@ -365,6 +365,7 @@ where #[cfg(feature = "python")] #[allow(missing_docs)] +#[allow(clippy::unnecessary_fallible_conversions)] /// `StdMutationalStage` Python bindings pub mod pybind { use pyo3::prelude::*; diff --git a/libafl_bolts/src/os/unix_shmem_server.rs b/libafl_bolts/src/os/unix_shmem_server.rs index 58d137bf54..a6c3f9f21d 100644 --- a/libafl_bolts/src/os/unix_shmem_server.rs +++ b/libafl_bolts/src/os/unix_shmem_server.rs @@ -556,7 +556,7 @@ where return Err(Error::illegal_state("Received empty ShMemId from unix shmem client. Are the shmem limits set correctly? Did a client crash?")); } - let description_id: i32 = description.id.try_into().unwrap(); + let description_id: i32 = description.id.into(); if !self.all_shmems.contains_key(&description_id) { // We should never get here, but it may happen if the OS ran out of shmem pages at some point//reached limits. diff --git a/libafl_bolts/src/rands.rs b/libafl_bolts/src/rands.rs index 39280ed9c9..7925435e28 100644 --- a/libafl_bolts/src/rands.rs +++ b/libafl_bolts/src/rands.rs @@ -435,6 +435,7 @@ mod tests { } #[cfg(feature = "python")] +#[allow(clippy::unnecessary_fallible_conversions)] #[allow(missing_docs)] /// `Rand` Python bindings pub mod pybind { From ce6f2058ec6997c08f5b0d78b9fec4b5424725d3 Mon Sep 17 00:00:00 2001 From: toka Date: Wed, 8 Nov 2023 14:29:47 +0100 Subject: [PATCH 4/4] ok --- libafl/src/observers/map.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libafl/src/observers/map.rs b/libafl/src/observers/map.rs index 27bc6aa56c..c8b363ace4 100644 --- a/libafl/src/observers/map.rs +++ b/libafl/src/observers/map.rs @@ -1331,6 +1331,7 @@ where slice::from_raw_parts_mut(map.as_mut_ptr().add(align_offset) as *mut u16, cnt) }; // 2022-07: Adding `enumerate` here increases execution speed/register allocation on x86_64. + #[allow(clippy::unused_enumerate_index)] for (_i, item) in map16[0..cnt].iter_mut().enumerate() { unsafe { *item = *COUNT_CLASS_LOOKUP_16.get_unchecked(*item as usize);