Fix lint errors (#1909)
* fix lints. * more lint fix. * even more lint fixes. * always more lint fixes. * lint fix. * allow unused qualifications for crate when it could be confusing. * Still lint fixes. * Lint fixes on generated code. * Some lint fixes.
This commit is contained in:
parent
b7efe8eb7d
commit
d96a1426d5
@ -251,7 +251,7 @@ where
|
|||||||
|
|
||||||
/// ``CachedOnDiskCorpus`` Python bindings
|
/// ``CachedOnDiskCorpus`` Python bindings
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[allow(clippy::unnecessary_fallible_conversions)]
|
#[allow(clippy::unnecessary_fallible_conversions, unused_qualifications)]
|
||||||
pub mod pybind {
|
pub mod pybind {
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
@ -429,7 +429,7 @@ where
|
|||||||
|
|
||||||
/// `InMemoryCorpus` Python bindings
|
/// `InMemoryCorpus` Python bindings
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[allow(clippy::unnecessary_fallible_conversions)]
|
#[allow(clippy::unnecessary_fallible_conversions, unused_qualifications)]
|
||||||
pub mod pybind {
|
pub mod pybind {
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -439,7 +439,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[allow(clippy::unnecessary_fallible_conversions)]
|
#[allow(clippy::unnecessary_fallible_conversions, unused_qualifications)]
|
||||||
/// `InMemoryOnDiskCorpus` Python bindings
|
/// `InMemoryOnDiskCorpus` Python bindings
|
||||||
pub mod pybind {
|
pub mod pybind {
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
|
@ -262,7 +262,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[allow(clippy::unnecessary_fallible_conversions)]
|
#[allow(clippy::unnecessary_fallible_conversions, unused_qualifications)]
|
||||||
/// `OnDiskCorpus` Python bindings
|
/// `OnDiskCorpus` Python bindings
|
||||||
pub mod pybind {
|
pub mod pybind {
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
|
@ -206,7 +206,7 @@ where
|
|||||||
self.shmem_provider.post_fork(true)?;
|
self.shmem_provider.post_fork(true)?;
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
std::thread::sleep(std::time::Duration::from_millis(index * 10));
|
std::thread::sleep(Duration::from_millis(index * 10));
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
if !debug_output {
|
if !debug_output {
|
||||||
@ -549,7 +549,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::thread::sleep(std::time::Duration::from_millis(10));
|
std::thread::sleep(Duration::from_millis(10));
|
||||||
|
|
||||||
// Spawn clients
|
// Spawn clients
|
||||||
let mut index = 0_u64;
|
let mut index = 0_u64;
|
||||||
@ -568,7 +568,7 @@ where
|
|||||||
log::info!("{:?} PostFork", unsafe { libc::getpid() });
|
log::info!("{:?} PostFork", unsafe { libc::getpid() });
|
||||||
self.shmem_provider.post_fork(true)?;
|
self.shmem_provider.post_fork(true)?;
|
||||||
|
|
||||||
std::thread::sleep(std::time::Duration::from_millis(index * 10));
|
std::thread::sleep(Duration::from_millis(index * 10));
|
||||||
|
|
||||||
if !debug_output {
|
if !debug_output {
|
||||||
if let Some(file) = &self.opened_stdout_file {
|
if let Some(file) = &self.opened_stdout_file {
|
||||||
|
@ -598,7 +598,7 @@ where
|
|||||||
/// `SimpleEventManager` Python bindings
|
/// `SimpleEventManager` Python bindings
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[allow(clippy::unnecessary_fallible_conversions)]
|
#[allow(clippy::unnecessary_fallible_conversions, unused_qualifications)]
|
||||||
pub mod pybind {
|
pub mod pybind {
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ use crate::{
|
|||||||
/// Tries to create (synchronously) a [`TcpListener`] that is `nonblocking` (for later use in tokio).
|
/// Tries to create (synchronously) a [`TcpListener`] that is `nonblocking` (for later use in tokio).
|
||||||
/// Will error if the port is already in use (or other errors occur)
|
/// Will error if the port is already in use (or other errors occur)
|
||||||
fn create_nonblocking_listener<A: ToSocketAddrs>(addr: A) -> Result<TcpListener, Error> {
|
fn create_nonblocking_listener<A: ToSocketAddrs>(addr: A) -> Result<TcpListener, Error> {
|
||||||
let listener = std::net::TcpListener::bind(addr)?;
|
let listener = TcpListener::bind(addr)?;
|
||||||
listener.set_nonblocking(true)?;
|
listener.set_nonblocking(true)?;
|
||||||
Ok(listener)
|
Ok(listener)
|
||||||
}
|
}
|
||||||
@ -1065,8 +1065,7 @@ where
|
|||||||
/// Launch the restarting manager
|
/// Launch the restarting manager
|
||||||
pub fn launch(&mut self) -> Result<(Option<S>, TcpRestartingEventManager<S, SP>), Error> {
|
pub fn launch(&mut self) -> Result<(Option<S>, TcpRestartingEventManager<S, SP>), Error> {
|
||||||
// We start ourself as child process to actually fuzz
|
// We start ourself as child process to actually fuzz
|
||||||
let (staterestorer, _new_shmem_provider, core_id) = if std::env::var(_ENV_FUZZER_SENDER)
|
let (staterestorer, _new_shmem_provider, core_id) = if env::var(_ENV_FUZZER_SENDER).is_err()
|
||||||
.is_err()
|
|
||||||
{
|
{
|
||||||
let broker_things = |mut broker: TcpEventBroker<S::Input, MT>, _remote_broker_addr| {
|
let broker_things = |mut broker: TcpEventBroker<S::Input, MT>, _remote_broker_addr| {
|
||||||
if let Some(exit_cleanly_after) = self.exit_cleanly_after {
|
if let Some(exit_cleanly_after) = self.exit_cleanly_after {
|
||||||
|
@ -37,8 +37,8 @@ impl<A, B, OTA, OTB, DOT> DiffExecutor<A, B, OTA, OTB, DOT> {
|
|||||||
primary,
|
primary,
|
||||||
secondary,
|
secondary,
|
||||||
observers: UnsafeCell::new(ProxyObserversTuple {
|
observers: UnsafeCell::new(ProxyObserversTuple {
|
||||||
primary: OwnedMutPtr::Ptr(core::ptr::null_mut()),
|
primary: OwnedMutPtr::Ptr(ptr::null_mut()),
|
||||||
secondary: OwnedMutPtr::Ptr(core::ptr::null_mut()),
|
secondary: OwnedMutPtr::Ptr(ptr::null_mut()),
|
||||||
differential: observers,
|
differential: observers,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -661,7 +661,7 @@ mod tests {
|
|||||||
|
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[allow(clippy::unnecessary_fallible_conversions)]
|
#[allow(clippy::unnecessary_fallible_conversions, unused_qualifications)]
|
||||||
/// `InProcess` Python bindings
|
/// `InProcess` Python bindings
|
||||||
pub mod pybind {
|
pub mod pybind {
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
|
@ -1096,7 +1096,7 @@ impl From<bool> for ConstFeedback {
|
|||||||
|
|
||||||
/// `Feedback` Python bindings
|
/// `Feedback` Python bindings
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[allow(clippy::unnecessary_fallible_conversions)]
|
#[allow(clippy::unnecessary_fallible_conversions, unused_qualifications)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub mod pybind {
|
pub mod pybind {
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
|
@ -170,7 +170,7 @@ where
|
|||||||
/// `Generator` Python bindings
|
/// `Generator` Python bindings
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[allow(clippy::unnecessary_fallible_conversions)]
|
#[allow(clippy::unnecessary_fallible_conversions, unused_qualifications)]
|
||||||
pub mod pybind {
|
pub mod pybind {
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
|
@ -1211,9 +1211,9 @@ impl ClientPerfMonitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
impl core::fmt::Display for ClientPerfMonitor {
|
impl fmt::Display for ClientPerfMonitor {
|
||||||
#[allow(clippy::cast_precision_loss)]
|
#[allow(clippy::cast_precision_loss)]
|
||||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||||
// Calculate the elapsed time from the monitor
|
// Calculate the elapsed time from the monitor
|
||||||
let elapsed: f64 = self.elapsed_cycles() as f64;
|
let elapsed: f64 = self.elapsed_cycles() as f64;
|
||||||
|
|
||||||
@ -1291,7 +1291,7 @@ impl Default for ClientPerfMonitor {
|
|||||||
}
|
}
|
||||||
/// `Monitor` Python bindings
|
/// `Monitor` Python bindings
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[allow(clippy::unnecessary_fallible_conversions)]
|
#[allow(clippy::unnecessary_fallible_conversions, unused_qualifications)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub mod pybind {
|
pub mod pybind {
|
||||||
use alloc::{boxed::Box, vec::Vec};
|
use alloc::{boxed::Box, vec::Vec};
|
||||||
|
@ -518,7 +518,7 @@ impl TuiMonitor {
|
|||||||
.map_or("None".to_string(), ToString::to_string);
|
.map_or("None".to_string(), ToString::to_string);
|
||||||
let stability = client.get_user_stats("stability").map_or(
|
let stability = client.get_user_stats("stability").map_or(
|
||||||
UserStats::new(UserStatsValue::Ratio(0, 100), AggregatorOps::Avg),
|
UserStats::new(UserStatsValue::Ratio(0, 100), AggregatorOps::Avg),
|
||||||
core::clone::Clone::clone,
|
Clone::clone,
|
||||||
);
|
);
|
||||||
|
|
||||||
if afl_stats != "None" {
|
if afl_stats != "None" {
|
||||||
@ -616,7 +616,7 @@ fn run_tui_thread<W: Write + Send + Sync + 'static>(
|
|||||||
let timeout = tick_rate
|
let timeout = tick_rate
|
||||||
.checked_sub(last_tick.elapsed())
|
.checked_sub(last_tick.elapsed())
|
||||||
.unwrap_or_else(|| Duration::from_secs(0));
|
.unwrap_or_else(|| Duration::from_secs(0));
|
||||||
if crossterm::event::poll(timeout)? {
|
if event::poll(timeout)? {
|
||||||
if let Event::Key(key) = event::read()? {
|
if let Event::Key(key) = event::read()? {
|
||||||
match key.code {
|
match key.code {
|
||||||
KeyCode::Char(c) => ui.on_key(c),
|
KeyCode::Char(c) => ui.on_key(c),
|
||||||
|
@ -601,7 +601,7 @@ mod tests {
|
|||||||
/// `SchedulerMutator` Python bindings
|
/// `SchedulerMutator` Python bindings
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[allow(clippy::unnecessary_fallible_conversions)]
|
#[allow(clippy::unnecessary_fallible_conversions, unused_qualifications)]
|
||||||
pub mod pybind {
|
pub mod pybind {
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
|
|
||||||
|
@ -28,13 +28,13 @@ pub struct Location(usize);
|
|||||||
|
|
||||||
impl Debug for Location {
|
impl Debug for Location {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
|
||||||
core::fmt::Debug::fmt(&self.0, f)
|
Debug::fmt(&self.0, f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Location {
|
impl Display for Location {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
|
||||||
core::fmt::Display::fmt(&self.0, f)
|
Display::fmt(&self.0, f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ impl<R: Read> MessageFileReader<R> {
|
|||||||
Some(Ok((message_id, message)))
|
Some(Ok((message_id, message)))
|
||||||
}
|
}
|
||||||
Err(e) => match *e {
|
Err(e) => match *e {
|
||||||
bincode::ErrorKind::Io(ref io_err) => match io_err.kind() {
|
ErrorKind::Io(ref io_err) => match io_err.kind() {
|
||||||
io::ErrorKind::UnexpectedEof => None,
|
io::ErrorKind::UnexpectedEof => None,
|
||||||
_ => Some(Err(e)),
|
_ => Some(Err(e)),
|
||||||
},
|
},
|
||||||
|
@ -378,7 +378,7 @@ where
|
|||||||
|
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[allow(clippy::unnecessary_fallible_conversions)]
|
#[allow(clippy::unnecessary_fallible_conversions, unused_qualifications)]
|
||||||
/// `StdMutationalStage` Python bindings
|
/// `StdMutationalStage` Python bindings
|
||||||
pub mod pybind {
|
pub mod pybind {
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
|
@ -984,6 +984,7 @@ impl log::Log for SimpleFdLogger {
|
|||||||
/// # Safety
|
/// # Safety
|
||||||
/// The function is arguably safe, but it might have undesirable side effects since it closes `stdout` and `stderr`.
|
/// The function is arguably safe, but it might have undesirable side effects since it closes `stdout` and `stderr`.
|
||||||
#[cfg(all(unix, feature = "std"))]
|
#[cfg(all(unix, feature = "std"))]
|
||||||
|
#[allow(unused_qualifications)]
|
||||||
pub unsafe fn dup_and_mute_outputs() -> Result<(RawFd, RawFd), Error> {
|
pub unsafe fn dup_and_mute_outputs() -> Result<(RawFd, RawFd), Error> {
|
||||||
let old_stdout = stdout().as_raw_fd();
|
let old_stdout = stdout().as_raw_fd();
|
||||||
let old_stderr = stderr().as_raw_fd();
|
let old_stderr = stderr().as_raw_fd();
|
||||||
@ -1010,7 +1011,7 @@ pub unsafe fn set_error_print_panic_hook(new_stderr: RawFd) {
|
|||||||
let mut f = unsafe { File::from_raw_fd(new_stderr) };
|
let mut f = unsafe { File::from_raw_fd(new_stderr) };
|
||||||
writeln!(f, "{panic_info}",)
|
writeln!(f, "{panic_info}",)
|
||||||
.unwrap_or_else(|err| println!("Failed to log to fd {new_stderr}: {err}"));
|
.unwrap_or_else(|err| println!("Failed to log to fd {new_stderr}: {err}"));
|
||||||
std::mem::forget(f);
|
mem::forget(f);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3210,7 +3210,7 @@ where
|
|||||||
Ok(stream) => stream,
|
Ok(stream) => stream,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
match e.kind() {
|
match e.kind() {
|
||||||
std::io::ErrorKind::ConnectionRefused => {
|
ErrorKind::ConnectionRefused => {
|
||||||
//connection refused. loop till the broker is up
|
//connection refused. loop till the broker is up
|
||||||
loop {
|
loop {
|
||||||
match TcpStream::connect((_LLMP_CONNECT_ADDR, port)) {
|
match TcpStream::connect((_LLMP_CONNECT_ADDR, port)) {
|
||||||
|
@ -435,7 +435,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
#[allow(clippy::unnecessary_fallible_conversions)]
|
#[allow(clippy::unnecessary_fallible_conversions, unused_qualifications)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
/// `Rand` Python bindings
|
/// `Rand` Python bindings
|
||||||
pub mod pybind {
|
pub mod pybind {
|
||||||
|
@ -162,7 +162,7 @@ impl ToolWrapper for ArWrapper {
|
|||||||
.base_args
|
.base_args
|
||||||
.iter()
|
.iter()
|
||||||
.map(|r| {
|
.map(|r| {
|
||||||
let arg_as_path = std::path::PathBuf::from(r);
|
let arg_as_path = PathBuf::from(r);
|
||||||
if r.ends_with('.') {
|
if r.ends_with('.') {
|
||||||
r.to_string()
|
r.to_string()
|
||||||
} else {
|
} else {
|
||||||
@ -185,7 +185,7 @@ impl ToolWrapper for ArWrapper {
|
|||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let Ok(ar_path) = std::env::var("LLVM_AR_PATH") else {
|
let Ok(ar_path) = env::var("LLVM_AR_PATH") else {
|
||||||
panic!("Couldn't find llvm-ar. Specify the `LLVM_AR_PATH` environment variable");
|
panic!("Couldn't find llvm-ar. Specify the `LLVM_AR_PATH` environment variable");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ impl ToolWrapper for ClangWrapper {
|
|||||||
let mut suppress_linking = 0;
|
let mut suppress_linking = 0;
|
||||||
let mut i = 1;
|
let mut i = 1;
|
||||||
while i < args.len() {
|
while i < args.len() {
|
||||||
let arg_as_path = std::path::Path::new(args[i].as_ref());
|
let arg_as_path = Path::new(args[i].as_ref());
|
||||||
|
|
||||||
if arg_as_path
|
if arg_as_path
|
||||||
.extension()
|
.extension()
|
||||||
@ -329,7 +329,7 @@ impl ToolWrapper for ClangWrapper {
|
|||||||
.base_args
|
.base_args
|
||||||
.iter()
|
.iter()
|
||||||
.map(|r| {
|
.map(|r| {
|
||||||
let arg_as_path = std::path::PathBuf::from(r);
|
let arg_as_path = PathBuf::from(r);
|
||||||
if r.ends_with('.') {
|
if r.ends_with('.') {
|
||||||
r.to_string()
|
r.to_string()
|
||||||
} else {
|
} else {
|
||||||
@ -366,7 +366,7 @@ impl ToolWrapper for ClangWrapper {
|
|||||||
// No output specified, we need to rewrite the single .c file's name into a -o
|
// No output specified, we need to rewrite the single .c file's name into a -o
|
||||||
// argument.
|
// argument.
|
||||||
for arg in &base_args {
|
for arg in &base_args {
|
||||||
let arg_as_path = std::path::PathBuf::from(arg);
|
let arg_as_path = PathBuf::from(arg);
|
||||||
if !arg.ends_with('.') && !arg.starts_with('-') {
|
if !arg.ends_with('.') && !arg.starts_with('-') {
|
||||||
if let Some(extension) = arg_as_path.extension() {
|
if let Some(extension) = arg_as_path.extension() {
|
||||||
let extension = extension.to_str().unwrap();
|
let extension = extension.to_str().unwrap();
|
||||||
@ -376,7 +376,7 @@ impl ToolWrapper for ClangWrapper {
|
|||||||
args.push("-o".to_string());
|
args.push("-o".to_string());
|
||||||
args.push(if self.linking {
|
args.push(if self.linking {
|
||||||
configuration
|
configuration
|
||||||
.replace_extension(&std::path::PathBuf::from("a.out"))
|
.replace_extension(&PathBuf::from("a.out"))
|
||||||
.into_os_string()
|
.into_os_string()
|
||||||
.into_string()
|
.into_string()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -146,12 +146,12 @@ impl Configuration {
|
|||||||
let output = output.to_str().unwrap();
|
let output = output.to_str().unwrap();
|
||||||
|
|
||||||
let new_filename = if let Some((filename, extension)) = output.split_once('.') {
|
let new_filename = if let Some((filename, extension)) = output.split_once('.') {
|
||||||
if let crate::Configuration::Default = self {
|
if let Configuration::Default = self {
|
||||||
format!("{filename}.{extension}")
|
format!("{filename}.{extension}")
|
||||||
} else {
|
} else {
|
||||||
format!("{filename}.{self}.{extension}")
|
format!("{filename}.{self}.{extension}")
|
||||||
}
|
}
|
||||||
} else if let crate::Configuration::Default = self {
|
} else if let Configuration::Default = self {
|
||||||
output.to_string()
|
output.to_string()
|
||||||
} else {
|
} else {
|
||||||
format!("{output}.{self}")
|
format!("{output}.{self}")
|
||||||
|
@ -170,7 +170,7 @@ impl ToolWrapper for LibtoolWrapper {
|
|||||||
.base_args
|
.base_args
|
||||||
.iter()
|
.iter()
|
||||||
.map(|r| {
|
.map(|r| {
|
||||||
let arg_as_path = std::path::PathBuf::from(r);
|
let arg_as_path = PathBuf::from(r);
|
||||||
if r.ends_with('.') {
|
if r.ends_with('.') {
|
||||||
r.to_string()
|
r.to_string()
|
||||||
} else {
|
} else {
|
||||||
@ -191,7 +191,7 @@ impl ToolWrapper for LibtoolWrapper {
|
|||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let libtool_path = if let Ok(libtool_dir) = std::env::var("LIBTOOL_DIR") {
|
let libtool_path = if let Ok(libtool_dir) = env::var("LIBTOOL_DIR") {
|
||||||
format!("{libtool_dir}/libtool")
|
format!("{libtool_dir}/libtool")
|
||||||
} else {
|
} else {
|
||||||
"./libtool".to_string()
|
"./libtool".to_string()
|
||||||
|
@ -542,7 +542,7 @@ impl AsanRuntime {
|
|||||||
#[allow(clippy::items_after_statements)]
|
#[allow(clippy::items_after_statements)]
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
fn hook_functions(&mut self, gum: &Gum) {
|
fn hook_functions(&mut self, gum: &Gum) {
|
||||||
let mut interceptor = frida_gum::interceptor::Interceptor::obtain(gum);
|
let mut interceptor = Interceptor::obtain(gum);
|
||||||
|
|
||||||
macro_rules! hook_func {
|
macro_rules! hook_func {
|
||||||
($lib:expr, $name:ident, ($($param:ident : $param_type:ty),*), $return_type:ty) => {
|
($lib:expr, $name:ident, ($($param:ident : $param_type:ty),*), $return_type:ty) => {
|
||||||
|
@ -661,11 +661,11 @@ impl CmpLogRuntime {
|
|||||||
)> {
|
)> {
|
||||||
let bytes = instr.bytes();
|
let bytes = instr.bytes();
|
||||||
let mut decoder =
|
let mut decoder =
|
||||||
iced_x86::Decoder::with_ip(64, bytes, instr.address(), iced_x86::DecoderOptions::NONE);
|
iced_x86::Decoder::with_ip(64, bytes, instr.address(), DecoderOptions::NONE);
|
||||||
if !decoder.can_decode() {
|
if !decoder.can_decode() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let mut instruction = iced_x86::Instruction::default();
|
let mut instruction = Instruction::default();
|
||||||
decoder.decode_out(&mut instruction);
|
decoder.decode_out(&mut instruction);
|
||||||
match instruction.mnemonic() {
|
match instruction.mnemonic() {
|
||||||
iced_x86::Mnemonic::Cmp | iced_x86::Mnemonic::Sub => {} // continue
|
iced_x86::Mnemonic::Cmp | iced_x86::Mnemonic::Sub => {} // continue
|
||||||
|
@ -10,7 +10,7 @@ fn main() {
|
|||||||
let build = bindgen::builder()
|
let build = bindgen::builder()
|
||||||
.header("src/harness_wrap.h")
|
.header("src/harness_wrap.h")
|
||||||
.generate_comments(true)
|
.generate_comments(true)
|
||||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
|
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||||
.generate()
|
.generate()
|
||||||
.expect("Couldn't generate the harness wrapper!");
|
.expect("Couldn't generate the harness wrapper!");
|
||||||
|
|
||||||
|
@ -105,6 +105,7 @@ mod harness_wrap {
|
|||||||
#![allow(improper_ctypes)]
|
#![allow(improper_ctypes)]
|
||||||
#![allow(clippy::unreadable_literal)]
|
#![allow(clippy::unreadable_literal)]
|
||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
|
#![allow(unused_qualifications)]
|
||||||
include!(concat!(env!("OUT_DIR"), "/harness_wrap.rs"));
|
include!(concat!(env!("OUT_DIR"), "/harness_wrap.rs"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ impl LibfuzzerOptions {
|
|||||||
let name = if let Some(executable) = std::env::current_exe().ok().and_then(|path| {
|
let name = if let Some(executable) = std::env::current_exe().ok().and_then(|path| {
|
||||||
path.file_name()
|
path.file_name()
|
||||||
.and_then(std::ffi::OsStr::to_str)
|
.and_then(std::ffi::OsStr::to_str)
|
||||||
.map(std::string::ToString::to_string)
|
.map(ToString::to_string)
|
||||||
}) {
|
}) {
|
||||||
executable
|
executable
|
||||||
} else {
|
} else {
|
||||||
@ -397,7 +397,7 @@ impl<'a> LibfuzzerOptionsBuilder<'a> {
|
|||||||
unknown: self
|
unknown: self
|
||||||
.unknown
|
.unknown
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(std::string::ToString::to_string)
|
.map(ToString::to_string)
|
||||||
.collect(),
|
.collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ pub fn generate(
|
|||||||
.allowlist_function("device_list_all")
|
.allowlist_function("device_list_all")
|
||||||
.allowlist_function("libafl_.*")
|
.allowlist_function("libafl_.*")
|
||||||
.blocklist_function("main_loop_wait") // bindgen issue #1313
|
.blocklist_function("main_loop_wait") // bindgen issue #1313
|
||||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks));
|
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()));
|
||||||
|
|
||||||
// arch specific functions
|
// arch specific functions
|
||||||
let bindings = if cpu_target == "i386" || cpu_target == "x86_64" {
|
let bindings = if cpu_target == "i386" || cpu_target == "x86_64" {
|
||||||
|
@ -214,7 +214,7 @@ fn main() {
|
|||||||
.header("src/sanitizer_interfaces.h")
|
.header("src/sanitizer_interfaces.h")
|
||||||
.use_core()
|
.use_core()
|
||||||
.generate_comments(true)
|
.generate_comments(true)
|
||||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
|
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||||
.generate()
|
.generate()
|
||||||
.expect("Couldn't generate the sanitizer headers!");
|
.expect("Couldn't generate the sanitizer headers!");
|
||||||
|
|
||||||
|
@ -29,13 +29,12 @@ pub const CMPLOG_MAP_SIZE: usize = CMPLOG_MAP_W * CMPLOG_MAP_H;
|
|||||||
pub const CMPLOG_RTN_LEN: usize = 32;
|
pub const CMPLOG_RTN_LEN: usize = 32;
|
||||||
|
|
||||||
/// The hight of a cmplog routine map
|
/// The hight of a cmplog routine map
|
||||||
pub const CMPLOG_MAP_RTN_H: usize = (CMPLOG_MAP_H * core::mem::size_of::<CmpLogInstruction>())
|
pub const CMPLOG_MAP_RTN_H: usize =
|
||||||
/ core::mem::size_of::<CmpLogRoutine>();
|
(CMPLOG_MAP_H * mem::size_of::<CmpLogInstruction>()) / mem::size_of::<CmpLogRoutine>();
|
||||||
|
|
||||||
/// The height of extended rountine map
|
/// The height of extended rountine map
|
||||||
pub const CMPLOG_MAP_RTN_EXTENDED_H: usize = CMPLOG_MAP_H
|
pub const CMPLOG_MAP_RTN_EXTENDED_H: usize =
|
||||||
* core::mem::size_of::<AFLppCmpLogOperands>()
|
CMPLOG_MAP_H * mem::size_of::<AFLppCmpLogOperands>() / mem::size_of::<AFLppCmpLogFnOperands>();
|
||||||
/ core::mem::size_of::<AFLppCmpLogFnOperands>();
|
|
||||||
|
|
||||||
/// `CmpLog` instruction kind
|
/// `CmpLog` instruction kind
|
||||||
pub const CMPLOG_KIND_INS: u8 = 0;
|
pub const CMPLOG_KIND_INS: u8 = 0;
|
||||||
@ -277,7 +276,7 @@ pub union AFLppCmpLogVals {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for AFLppCmpLogVals {
|
impl Debug for AFLppCmpLogVals {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
f.debug_struct("AFLppCmpLogVals").finish_non_exhaustive()
|
f.debug_struct("AFLppCmpLogVals").finish_non_exhaustive()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -324,7 +323,7 @@ pub struct CmpLogMap {
|
|||||||
|
|
||||||
impl Default for CmpLogMap {
|
impl Default for CmpLogMap {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
unsafe { core::mem::zeroed() }
|
unsafe { mem::zeroed() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +492,7 @@ impl<'de> Deserialize<'de> for AFLppCmpLogMap {
|
|||||||
D: Deserializer<'de>,
|
D: Deserializer<'de>,
|
||||||
{
|
{
|
||||||
let bytes = Vec::<u8>::deserialize(deserializer)?;
|
let bytes = Vec::<u8>::deserialize(deserializer)?;
|
||||||
let map: Self = unsafe { core::ptr::read(bytes.as_ptr() as *const _) };
|
let map: Self = unsafe { ptr::read(bytes.as_ptr() as *const _) };
|
||||||
Ok(map)
|
Ok(map)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,7 @@ pub mod sanitizer_ifaces {
|
|||||||
#![allow(clippy::unreadable_literal)]
|
#![allow(clippy::unreadable_literal)]
|
||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
#![allow(missing_debug_implementations)]
|
#![allow(missing_debug_implementations)]
|
||||||
|
#![allow(unused_qualifications)]
|
||||||
include!(concat!(env!("OUT_DIR"), "/sanitizer_interfaces.rs"));
|
include!(concat!(env!("OUT_DIR"), "/sanitizer_interfaces.rs"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user