Batch timeout fix (#2109)

* fix

* FMT

* unused
This commit is contained in:
Dongjia "toka" Zhang 2024-04-26 17:10:36 +02:00 committed by GitHub
parent 32963be453
commit 084b9b5878
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 6 deletions

View File

@ -53,7 +53,7 @@ use libafl_targets::{
libfuzzer_initialize, libfuzzer_test_one_input, std_edges_map_observer, CmpLogObserver,
};
#[cfg(unix)]
use nix::{self, unistd::dup};
use nix::unistd::dup;
/// The fuzzer main (as `no_mangle` C function)
#[no_mangle]

View File

@ -55,7 +55,7 @@ use libafl_qemu::{
QemuShutdownCause, Regs,
};
#[cfg(unix)]
use nix::{self, unistd::dup};
use nix::unistd::dup;
/// The fuzzer main
pub fn main() {

View File

@ -65,7 +65,7 @@ use libafl_qemu::{
Regs,
};
#[cfg(unix)]
use nix::{self, unistd::dup};
use nix::unistd::dup;
pub const MAX_INPUT_SIZE: usize = 1048576; // 1MB

View File

@ -59,7 +59,7 @@ use libafl_targets::{
libfuzzer_initialize, libfuzzer_test_one_input, std_edges_map_observer, CmpLogObserver,
};
#[cfg(unix)]
use nix::{self, unistd::dup};
use nix::unistd::dup;
/// The fuzzer main (as `no_mangle` C function)
#[no_mangle]

View File

@ -325,6 +325,7 @@ impl TimerStruct {
if self.batch_mode {
unsafe {
let elapsed = current_time().saturating_sub(self.tmout_start_time);
let elapsed_since_signal = current_time().saturating_sub(self.tmout_start_time);
// elapsed may be > than tmout in case of received but ingored signal
if elapsed > self.exec_tmout
|| self.exec_tmout.saturating_sub(elapsed) < self.avg_exec_time * self.avg_mul_k
@ -337,8 +338,7 @@ impl TimerStruct {
self.executions = 0;
}
// readjust K
if self.last_signal_time > self.exec_tmout * self.avg_mul_k
&& self.avg_mul_k > 1
if elapsed_since_signal > self.exec_tmout * self.avg_mul_k && self.avg_mul_k > 1
{
self.avg_mul_k -= 1;
}