win for the win
This commit is contained in:
parent
d5e8bdbb6d
commit
b385b43e7e
@ -11,6 +11,7 @@ use core::{
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
#[cfg(unix)]
|
||||||
use crate::shmem::AflShmem;
|
use crate::shmem::AflShmem;
|
||||||
use crate::{
|
use crate::{
|
||||||
corpus::Corpus,
|
corpus::Corpus,
|
||||||
@ -718,6 +719,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
#[cfg(unix)]
|
||||||
impl<I, ST> LlmpEventManager<I, AflShmem, ST>
|
impl<I, ST> LlmpEventManager<I, AflShmem, ST>
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
#[cfg(unix)]
|
||||||
use os_signals::set_oncrash_ptrs;
|
use os_signals::set_oncrash_ptrs;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -20,8 +21,10 @@ use crate::{
|
|||||||
use unix_signals as os_signals;
|
use unix_signals as os_signals;
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
#[cfg(unix)]
|
||||||
use self::os_signals::reset_oncrash_ptrs;
|
use self::os_signals::reset_oncrash_ptrs;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
#[cfg(unix)]
|
||||||
use self::os_signals::setup_crash_handlers;
|
use self::os_signals::setup_crash_handlers;
|
||||||
|
|
||||||
/// The inmem executor harness
|
/// The inmem executor harness
|
||||||
@ -150,6 +153,7 @@ where
|
|||||||
EM: EventManager<I>,
|
EM: EventManager<I>,
|
||||||
{
|
{
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
#[cfg(unix)]
|
||||||
unsafe {
|
unsafe {
|
||||||
setup_crash_handlers::<C, EM, FT, I, OT, R>();
|
setup_crash_handlers::<C, EM, FT, I, OT, R>();
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// too.)
|
// too.)
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
#[cfg(unix)]
|
||||||
pub use shmem::AflShmem;
|
pub use shmem::AflShmem;
|
||||||
|
|
||||||
use alloc::string::{String, ToString};
|
use alloc::string::{String, ToString};
|
||||||
@ -95,6 +96,7 @@ pub trait ShMem: Sized + Debug {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub mod shmem {
|
pub mod shmem {
|
||||||
|
|
||||||
@ -106,6 +108,7 @@ pub mod shmem {
|
|||||||
|
|
||||||
use super::ShMem;
|
use super::ShMem;
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
fn snprintf(_: *mut c_char, _: c_ulong, _: *const c_char, _: ...) -> c_int;
|
fn snprintf(_: *mut c_char, _: c_ulong, _: *const c_char, _: ...) -> c_int;
|
||||||
@ -119,6 +122,7 @@ pub mod shmem {
|
|||||||
fn shmat(__shmid: c_int, __shmaddr: *const c_void, __shmflg: c_int) -> *mut c_void;
|
fn shmat(__shmid: c_int, __shmaddr: *const c_void, __shmflg: c_int) -> *mut c_void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
struct ipc_perm {
|
struct ipc_perm {
|
||||||
@ -135,6 +139,7 @@ pub mod shmem {
|
|||||||
pub __glibc_reserved2: c_ulong,
|
pub __glibc_reserved2: c_ulong,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
struct shmid_ds {
|
struct shmid_ds {
|
||||||
@ -151,6 +156,7 @@ pub mod shmem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The default Sharedmap impl for unix using shmctl & shmget
|
/// The default Sharedmap impl for unix using shmctl & shmget
|
||||||
|
#[cfg(unix)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct AflShmem {
|
pub struct AflShmem {
|
||||||
pub shm_str: [u8; 20],
|
pub shm_str: [u8; 20],
|
||||||
@ -159,6 +165,7 @@ pub mod shmem {
|
|||||||
pub map_size: usize,
|
pub map_size: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
impl ShMem for AflShmem {
|
impl ShMem for AflShmem {
|
||||||
fn existing_from_shm_slice(
|
fn existing_from_shm_slice(
|
||||||
map_str_bytes: &[u8; 20],
|
map_str_bytes: &[u8; 20],
|
||||||
@ -197,6 +204,7 @@ pub mod shmem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Create an uninitialized shmap
|
/// Create an uninitialized shmap
|
||||||
|
#[cfg(unix)]
|
||||||
const fn afl_shmem_unitialized() -> AflShmem {
|
const fn afl_shmem_unitialized() -> AflShmem {
|
||||||
AflShmem {
|
AflShmem {
|
||||||
shm_str: [0; 20],
|
shm_str: [0; 20],
|
||||||
@ -206,6 +214,7 @@ pub mod shmem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
impl AflShmem {
|
impl AflShmem {
|
||||||
pub fn from_str(shm_str: &CStr, map_size: usize) -> Result<Self, AflError> {
|
pub fn from_str(shm_str: &CStr, map_size: usize) -> Result<Self, AflError> {
|
||||||
let mut ret = afl_shmem_unitialized();
|
let mut ret = afl_shmem_unitialized();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user