allow resets to do unsafe stuff
This commit is contained in:
parent
7297c9421d
commit
336098ded1
@ -162,10 +162,10 @@ fn new_map_size(max_alloc: usize) -> usize {
|
|||||||
|
|
||||||
/// Initialize a new llmp_page. size should be relative to
|
/// Initialize a new llmp_page. size should be relative to
|
||||||
/// llmp_page->messages
|
/// llmp_page->messages
|
||||||
unsafe fn _llmp_page_init<SH: ShMem>(shmem: &mut SH, sender: u32) {
|
unsafe fn _llmp_page_init<SH: ShMem>(shmem: &mut SH, sender: u32, allow_reinit: bool) {
|
||||||
let map_size = shmem.map().len();
|
let map_size = shmem.map().len();
|
||||||
let page = shmem2page_mut(shmem);
|
let page = shmem2page_mut(shmem);
|
||||||
if (*page).magic == PAGE_INITIALIZED_MAGIC {
|
if (*page).magic == PAGE_INITIALIZED_MAGIC && !allow_reinit {
|
||||||
panic!(
|
panic!(
|
||||||
"Tried to initialize page {:?} twice (for shmem {:?})",
|
"Tried to initialize page {:?} twice (for shmem {:?})",
|
||||||
page, shmem
|
page, shmem
|
||||||
@ -417,7 +417,7 @@ where
|
|||||||
/// Afterwards, no receiver should read from it at a different location.
|
/// Afterwards, no receiver should read from it at a different location.
|
||||||
/// This is only useful if all connected llmp parties start over, for example after a crash.
|
/// This is only useful if all connected llmp parties start over, for example after a crash.
|
||||||
pub unsafe fn reset_last_page(&mut self) {
|
pub unsafe fn reset_last_page(&mut self) {
|
||||||
_llmp_page_init(&mut self.out_maps.last_mut().unwrap().shmem, self.id);
|
_llmp_page_init(&mut self.out_maps.last_mut().unwrap().shmem, self.id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reattach to a vacant out_map, to with a previous sender stored the information in an env before.
|
/// Reattach to a vacant out_map, to with a previous sender stored the information in an env before.
|
||||||
@ -945,7 +945,7 @@ where
|
|||||||
/// Creates a new page, initializing the passed shared mem struct
|
/// Creates a new page, initializing the passed shared mem struct
|
||||||
pub fn new(sender: u32, mut new_map: SH) -> Self {
|
pub fn new(sender: u32, mut new_map: SH) -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
_llmp_page_init(&mut new_map, sender);
|
_llmp_page_init(&mut new_map, sender, false);
|
||||||
}
|
}
|
||||||
Self { shmem: new_map }
|
Self { shmem: new_map }
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ fn fuzz(input: Option<Vec<PathBuf>>, broker_port: u16) -> Result<(), AflError> {
|
|||||||
let mut rand = StdRand::new(0);
|
let mut rand = StdRand::new(0);
|
||||||
let mut generator = RandPrintablesGenerator::new(32);
|
let mut generator = RandPrintablesGenerator::new(32);
|
||||||
let stats = SimpleStats::new(|s| println!("{}", s));
|
let stats = SimpleStats::new(|s| println!("{}", s));
|
||||||
let mut mgr;
|
let mut mgr: LlmpEventManager<_, _, _>;
|
||||||
|
|
||||||
// We start ourself as child process to actually fuzz
|
// We start ourself as child process to actually fuzz
|
||||||
if std::env::var(ENV_FUZZER_SENDER).is_err() {
|
if std::env::var(ENV_FUZZER_SENDER).is_err() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user