libafl multimachine: disable ratelimiting (#2558)
* disable rate limiting for now * fix * clippy --------- Co-authored-by: Dongjia "toka" Zhang <tokazerkje@outlook.com>
This commit is contained in:
parent
17def0390d
commit
173aeddbcc
@ -210,6 +210,8 @@ where
|
|||||||
.send_interesting_event_to_nodes(&mm_msg)
|
.send_interesting_event_to_nodes(&mm_msg)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
log::debug!("msg sent.");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ use crate::{
|
|||||||
inputs::{Input, NopInput},
|
inputs::{Input, NopInput},
|
||||||
};
|
};
|
||||||
|
|
||||||
const MAX_NB_RECEIVED_AT_ONCE: usize = 10;
|
// const MAX_NB_RECEIVED_AT_ONCE: usize = 100;
|
||||||
|
|
||||||
#[bitflags(default = SendToParent | SendToChildren)]
|
#[bitflags(default = SendToParent | SendToChildren)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
@ -394,7 +394,9 @@ where
|
|||||||
|
|
||||||
// 1. Read msg size
|
// 1. Read msg size
|
||||||
let mut node_msg_len: [u8; 4] = [0; 4];
|
let mut node_msg_len: [u8; 4] = [0; 4];
|
||||||
|
log::debug!("Receiving msg len...");
|
||||||
stream.read_exact(&mut node_msg_len).await?;
|
stream.read_exact(&mut node_msg_len).await?;
|
||||||
|
log::debug!("msg len received.");
|
||||||
let node_msg_len = u32::from_le_bytes(node_msg_len) as usize;
|
let node_msg_len = u32::from_le_bytes(node_msg_len) as usize;
|
||||||
|
|
||||||
// 2. Read msg
|
// 2. Read msg
|
||||||
@ -404,7 +406,9 @@ where
|
|||||||
unsafe {
|
unsafe {
|
||||||
node_msg.set_len(node_msg_len);
|
node_msg.set_len(node_msg_len);
|
||||||
}
|
}
|
||||||
|
log::debug!("Receiving msg...");
|
||||||
stream.read_exact(node_msg.as_mut_slice()).await?;
|
stream.read_exact(node_msg.as_mut_slice()).await?;
|
||||||
|
log::debug!("msg received.");
|
||||||
let node_msg = node_msg.into_boxed_slice();
|
let node_msg = node_msg.into_boxed_slice();
|
||||||
|
|
||||||
Ok(Some(MultiMachineMsg::from_llmp_msg(node_msg)))
|
Ok(Some(MultiMachineMsg::from_llmp_msg(node_msg)))
|
||||||
@ -420,16 +424,19 @@ where
|
|||||||
let msg_len = u32::to_le_bytes(serialized_msg.len() as u32);
|
let msg_len = u32::to_le_bytes(serialized_msg.len() as u32);
|
||||||
|
|
||||||
// 0. Write the dummy byte
|
// 0. Write the dummy byte
|
||||||
log::debug!("Sending dummy byte");
|
log::debug!("Sending dummy byte...");
|
||||||
stream.write_all(&[DUMMY_BYTE]).await?;
|
stream.write_all(&[DUMMY_BYTE]).await?;
|
||||||
|
log::debug!("dummy byte sent.");
|
||||||
|
|
||||||
// 1. Write msg size
|
// 1. Write msg size
|
||||||
log::debug!("Sending msg len");
|
log::debug!("Sending msg len...");
|
||||||
stream.write_all(&msg_len).await?;
|
stream.write_all(&msg_len).await?;
|
||||||
|
log::debug!("msg len sent.");
|
||||||
|
|
||||||
// 2. Write msg
|
// 2. Write msg
|
||||||
log::debug!("Sending msg");
|
log::debug!("Sending msg...");
|
||||||
stream.write_all(serialized_msg).await?;
|
stream.write_all(serialized_msg).await?;
|
||||||
|
log::debug!("msg sent.");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -483,11 +490,11 @@ where
|
|||||||
{
|
{
|
||||||
let mut ids_to_remove: Vec<NodeId> = Vec::new();
|
let mut ids_to_remove: Vec<NodeId> = Vec::new();
|
||||||
for (child_id, child_stream) in &mut self.children {
|
for (child_id, child_stream) in &mut self.children {
|
||||||
log::debug!("Sending to child...");
|
log::debug!("Sending to child {child_id:?}...");
|
||||||
if (Self::write_msg(child_stream, msg).await).is_err() {
|
if let Err(err) = Self::write_msg(child_stream, msg).await {
|
||||||
// most likely the child disconnected. drop the connection later on and continue.
|
// most likely the child disconnected. drop the connection later on and continue.
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"The child disconnected. We won't try to communicate with it again."
|
"The child disconnected. We won't try to communicate with it again. Error: {err:?}"
|
||||||
);
|
);
|
||||||
ids_to_remove.push(*child_id);
|
ids_to_remove.push(*child_id);
|
||||||
}
|
}
|
||||||
@ -510,15 +517,17 @@ where
|
|||||||
msgs: &mut Vec<MultiMachineMsg<'a, I>>,
|
msgs: &mut Vec<MultiMachineMsg<'a, I>>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
log::debug!("Checking for new events from other nodes...");
|
log::debug!("Checking for new events from other nodes...");
|
||||||
let mut nb_received = 0usize;
|
// let mut nb_received = 0usize;
|
||||||
|
|
||||||
// Our (potential) parent could have something for us
|
// Our (potential) parent could have something for us
|
||||||
if let Some(parent) = &mut self.parent {
|
if let Some(parent) = &mut self.parent {
|
||||||
loop {
|
loop {
|
||||||
// Exit if received a lot of inputs at once.
|
// Exit if received a lot of inputs at once.
|
||||||
if nb_received > MAX_NB_RECEIVED_AT_ONCE {
|
// TODO: this causes problems in some cases, it could freeze all fuzzer instances.
|
||||||
return Ok(());
|
// if nb_received > MAX_NB_RECEIVED_AT_ONCE {
|
||||||
}
|
// log::debug!("hitting MAX_NB_RECEIVED_AT_ONCE limit...");
|
||||||
|
// return Ok(());
|
||||||
|
// }
|
||||||
|
|
||||||
log::debug!("Receiving from parent...");
|
log::debug!("Receiving from parent...");
|
||||||
match Self::read_msg(parent).await {
|
match Self::read_msg(parent).await {
|
||||||
@ -526,7 +535,7 @@ where
|
|||||||
log::debug!("Received event from parent");
|
log::debug!("Received event from parent");
|
||||||
// The parent has something for us, we store it
|
// The parent has something for us, we store it
|
||||||
msgs.push(msg);
|
msgs.push(msg);
|
||||||
nb_received += 1;
|
// nb_received += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
@ -562,17 +571,17 @@ where
|
|||||||
for (child_id, child_stream) in &mut self.children {
|
for (child_id, child_stream) in &mut self.children {
|
||||||
loop {
|
loop {
|
||||||
// Exit if received a lot of inputs at once.
|
// Exit if received a lot of inputs at once.
|
||||||
if nb_received > MAX_NB_RECEIVED_AT_ONCE {
|
// if nb_received > MAX_NB_RECEIVED_AT_ONCE {
|
||||||
return Ok(());
|
// return Ok(());
|
||||||
}
|
//}
|
||||||
|
|
||||||
log::debug!("Receiving from child {:?}...", child_id);
|
log::debug!("Receiving from child {child_id:?}...");
|
||||||
match Self::read_msg(child_stream).await {
|
match Self::read_msg(child_stream).await {
|
||||||
Ok(Some(msg)) => {
|
Ok(Some(msg)) => {
|
||||||
// The parent has something for us, we store it
|
// The parent has something for us, we store it
|
||||||
log::debug!("Received event from child!");
|
log::debug!("Received event from child!");
|
||||||
msgs.push(msg);
|
msgs.push(msg);
|
||||||
nb_received += 1;
|
// nb_received += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
@ -584,7 +593,7 @@ where
|
|||||||
Err(Error::OsError(e, _, _)) => {
|
Err(Error::OsError(e, _, _)) => {
|
||||||
// most likely the parent disconnected. drop the connection
|
// most likely the parent disconnected. drop the connection
|
||||||
log::error!(
|
log::error!(
|
||||||
"The parent disconnected. We won't try to communicate with it again."
|
"The child disconnected. We won't try to communicate with it again."
|
||||||
);
|
);
|
||||||
log::error!("Error: {e:?}");
|
log::error!("Error: {e:?}");
|
||||||
ids_to_remove.push(*child_id);
|
ids_to_remove.push(*child_id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user