This commit is contained in:
Dongjia "toka" Zhang 2023-02-28 01:08:19 +09:00 committed by GitHub
parent 0727c80347
commit 59bf118a5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 22 additions and 19 deletions

View File

@ -58,7 +58,7 @@ fn from_exe<H: Hasher>(mut hasher: H) -> Result<H, ()> {
return Err(()); return Err(());
} }
let file = File::open(env::current_exe().map_err(drop)?).map_err(drop)?; let file = File::open(env::current_exe().map_err(drop)?).map_err(drop)?;
let _ = io::copy(&mut &file, &mut HashWriter(&mut hasher)).map_err(drop)?; let _: u64 = io::copy(&mut &file, &mut HashWriter(&mut hasher)).map_err(drop)?;
Ok(hasher) Ok(hasher)
} }
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]

View File

@ -34,7 +34,7 @@ impl Pipe {
/// Close the read end of a pipe /// Close the read end of a pipe
pub fn close_read_end(&mut self) { pub fn close_read_end(&mut self) {
if let Some(read_end) = self.read_end { if let Some(read_end) = self.read_end {
let _ = close(read_end); let _: Result<(), nix::errno::Errno> = close(read_end);
self.read_end = None; self.read_end = None;
} }
} }
@ -42,7 +42,7 @@ impl Pipe {
/// Close the write end of a pipe /// Close the write end of a pipe
pub fn close_write_end(&mut self) { pub fn close_write_end(&mut self) {
if let Some(write_end) = self.write_end { if let Some(write_end) = self.write_end {
let _ = close(write_end); let _: Result<(), nix::errno::Errno> = close(write_end);
self.write_end = None; self.write_end = None;
} }
} }
@ -102,10 +102,10 @@ impl Write for Pipe {
impl Drop for Pipe { impl Drop for Pipe {
fn drop(&mut self) { fn drop(&mut self) {
if let Some(read_end) = self.read_end { if let Some(read_end) = self.read_end {
let _ = close(read_end); let _: Result<(), nix::errno::Errno> = close(read_end);
} }
if let Some(write_end) = self.write_end { if let Some(write_end) = self.write_end {
let _ = close(write_end); let _: Result<(), nix::errno::Errno> = close(write_end);
} }
} }
} }

View File

@ -39,7 +39,7 @@ impl<'a, T> DownsizeSlice for &'a mut [T] {
fn downsize(&mut self, len: usize) { fn downsize(&mut self, len: usize) {
let mut value = core::mem::take(self); let mut value = core::mem::take(self);
value = unsafe { value.get_unchecked_mut(..len) }; value = unsafe { value.get_unchecked_mut(..len) };
let _ = core::mem::replace(self, value); let _: &mut [T] = core::mem::replace(self, value);
} }
} }

View File

@ -71,7 +71,7 @@ where
fn get(&self, idx: CorpusId) -> Result<&RefCell<Testcase<I>>, Error> { fn get(&self, idx: CorpusId) -> Result<&RefCell<Testcase<I>>, Error> {
let testcase = { self.inner.get(idx)? }; let testcase = { self.inner.get(idx)? };
if testcase.borrow().input().is_none() { if testcase.borrow().input().is_none() {
let _ = testcase.borrow_mut().load_input()?; let _: &I = testcase.borrow_mut().load_input()?;
let mut borrowed_num = 0; let mut borrowed_num = 0;
while self.cached_indexes.borrow().len() >= self.cache_max_len { while self.cached_indexes.borrow().len() >= self.cache_max_len {
let removed = self.cached_indexes.borrow_mut().pop_front().unwrap(); let removed = self.cached_indexes.borrow_mut().pop_front().unwrap();

View File

@ -492,7 +492,8 @@ where
self.executor.forkserver_mut().set_last_run_timed_out(1); self.executor.forkserver_mut().set_last_run_timed_out(1);
// We need to kill the child in case he has timed out, or we can't get the correct pid in the next call to self.executor.forkserver_mut().read_st()? // We need to kill the child in case he has timed out, or we can't get the correct pid in the next call to self.executor.forkserver_mut().read_st()?
let _ = kill(self.executor.forkserver().child_pid(), self.signal); let _: Result<(), nix::errno::Errno> =
kill(self.executor.forkserver().child_pid(), self.signal);
let (recv_status_len, _) = self.executor.forkserver_mut().read_st()?; let (recv_status_len, _) = self.executor.forkserver_mut().read_st()?;
if recv_status_len != 4 { if recv_status_len != 4 {
return Err(Error::unknown("Could not kill timed-out child".to_string())); return Err(Error::unknown("Could not kill timed-out child".to_string()));

View File

@ -1668,7 +1668,7 @@ where
); );
// log::info!("Set timer! {:#?} {timerid:#?}", self.itimerspec); // log::info!("Set timer! {:#?} {timerid:#?}", self.itimerspec);
let _ = libc::timer_settime( let _: i32 = libc::timer_settime(
timerid, timerid,
0, 0,
addr_of_mut!(self.itimerspec), addr_of_mut!(self.itimerspec),

View File

@ -504,7 +504,7 @@ where
// several is_interesting implementations collect some data about the run, later used in // several is_interesting implementations collect some data about the run, later used in
// append_metadata; we *must* invoke is_interesting here to collect it // append_metadata; we *must* invoke is_interesting here to collect it
let _ = self let _: bool = self
.feedback_mut() .feedback_mut()
.is_interesting(state, manager, &input, observers, &exit_kind)?; .is_interesting(state, manager, &input, observers, &exit_kind)?;

View File

@ -1,7 +1,6 @@
//! Generators may generate bytes or, in general, data, for inputs. //! Generators may generate bytes or, in general, data, for inputs.
use alloc::string::String; use alloc::{string::String, vec::Vec};
use alloc::vec::Vec;
use core::marker::PhantomData; use core::marker::PhantomData;
use crate::{ use crate::{

View File

@ -115,7 +115,7 @@ impl ClientStats {
.checked_sub(self.last_window_time) .checked_sub(self.last_window_time)
.map_or(0, |d| d.as_secs()); .map_or(0, |d| d.as_secs());
if diff > CLIENT_STATS_TIME_WINDOW_SECS { if diff > CLIENT_STATS_TIME_WINDOW_SECS {
let _ = self.execs_per_sec(cur_time); let _: f64 = self.execs_per_sec(cur_time);
self.last_window_time = cur_time; self.last_window_time = cur_time;
self.last_window_executions = self.executions; self.last_window_executions = self.executions;
} }

View File

@ -384,7 +384,8 @@ where
input_copy.bytes_mut()[index] = new_byte; input_copy.bytes_mut()[index] = new_byte;
} }
// Time is measured directly the `evaluate_input` function // Time is measured directly the `evaluate_input` function
let _ = fuzzer.evaluate_input(state, executor, manager, input_copy)?; let _: (crate::ExecuteInputResult, Option<CorpusId>) =
fuzzer.evaluate_input(state, executor, manager, input_copy)?;
} }
} }
Ok(()) Ok(())

View File

@ -17,7 +17,7 @@ use crate::{
rands::Rand, rands::Rand,
serdeany::{NamedSerdeAnyMap, SerdeAny, SerdeAnyMap}, serdeany::{NamedSerdeAnyMap, SerdeAny, SerdeAnyMap},
}, },
corpus::Corpus, corpus::{Corpus, CorpusId},
events::{Event, EventFirer, LogSeverity}, events::{Event, EventFirer, LogSeverity},
feedbacks::Feedback, feedbacks::Feedback,
fuzzer::{Evaluator, ExecuteInputResult}, fuzzer::{Evaluator, ExecuteInputResult},
@ -471,7 +471,7 @@ where
log::info!("Loading file {:?} ...", &path); log::info!("Loading file {:?} ...", &path);
let input = loader(fuzzer, self, &path)?; let input = loader(fuzzer, self, &path)?;
if forced { if forced {
let _ = fuzzer.add_input(self, executor, manager, input)?; let _: CorpusId = fuzzer.add_input(self, executor, manager, input)?;
} else { } else {
let (res, _) = fuzzer.evaluate_input(self, executor, manager, input)?; let (res, _) = fuzzer.evaluate_input(self, executor, manager, input)?;
if res == ExecuteInputResult::None { if res == ExecuteInputResult::None {
@ -617,7 +617,7 @@ where
for _ in 0..num { for _ in 0..num {
let input = generator.generate(self)?; let input = generator.generate(self)?;
if forced { if forced {
let _ = fuzzer.add_input(self, executor, manager, input)?; let _: CorpusId = fuzzer.add_input(self, executor, manager, input)?;
added += 1; added += 1;
} else { } else {
let (res, _) = fuzzer.evaluate_input(self, executor, manager, input)?; let (res, _) = fuzzer.evaluate_input(self, executor, manager, input)?;

View File

@ -398,7 +398,8 @@ pub fn build(
println!("cargo:rustc-link-lib=z"); println!("cargo:rustc-link-lib=z");
// if keyutils is available, qemu meson script will compile code with keyutils. // if keyutils is available, qemu meson script will compile code with keyutils.
// therefore, we need to link with keyutils if our system have libkeyutils. // therefore, we need to link with keyutils if our system have libkeyutils.
let _ = pkg_config::Config::new().probe("libkeyutils"); let _: Result<pkg_config::Library, pkg_config::Error> =
pkg_config::Config::new().probe("libkeyutils");
if !is_usermode { if !is_usermode {
println!("cargo:rustc-link-lib=pixman-1"); println!("cargo:rustc-link-lib=pixman-1");

View File

@ -42,6 +42,7 @@ pub struct QemuDrCovHelper {
impl QemuDrCovHelper { impl QemuDrCovHelper {
#[must_use] #[must_use]
#[allow(clippy::let_underscore_untyped)]
pub fn new( pub fn new(
filter: QemuInstrumentationFilter, filter: QemuInstrumentationFilter,
module_mapping: RangeMap<usize, (u16, String)>, module_mapping: RangeMap<usize, (u16, String)>,

View File

@ -10,6 +10,6 @@ pub static mut COUNTERS_MAPS: Vec<&'static mut [u8]> = Vec::new();
#[no_mangle] #[no_mangle]
#[allow(clippy::cast_sign_loss)] #[allow(clippy::cast_sign_loss)]
#[allow(clippy::not_unsafe_ptr_arg_deref)] #[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn __sanitizer_cov_8bit_counters_init(start: *mut u8, stop: *mut u8) { pub extern "C" fn __sanitizer_cov_8bit_counters_init(start: *mut u8, stop: *mut u8) {
unsafe { COUNTERS_MAPS.push(from_raw_parts_mut(start, stop.offset_from(start) as usize)) } unsafe { COUNTERS_MAPS.push(from_raw_parts_mut(start, stop.offset_from(start) as usize)) }
} }