Companion patch to qemu-libafl-bridge #46 (#1830)

* fixing qemu-libafl-bridge #46

* cargo fmt

* updated QEMU revision

---------

Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com>
This commit is contained in:
cube0x8 2024-02-15 17:30:05 +02:00 committed by GitHub
parent 97a83aba3b
commit b999b4aac5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -8,7 +8,7 @@ use which::which;
const QEMU_URL: &str = "https://github.com/AFLplusplus/qemu-libafl-bridge";
const QEMU_DIRNAME: &str = "qemu-libafl-bridge";
const QEMU_REVISION: &str = "75d15d54f4417a4766d2dcb493982d9df0e8eac4";
const QEMU_REVISION: &str = "194b3a987c751f98c0db0f3537fa789b43b4e663";
pub struct BuildResult {
pub qemu_path: PathBuf,

View File

@ -390,7 +390,7 @@ extern_c_checked! {
fn read_self_maps() -> *const c_void;
fn free_self_maps(map_info: *const c_void);
fn libafl_maps_next(map_info: *const c_void, ret: *mut MapInfo) -> *const c_void;
fn libafl_maps_next(map_info: *const c_void, ret: *mut MapInfo, is_root: bool) -> *const c_void;
static exec_path: *const u8;
static guest_base: usize;
@ -461,6 +461,7 @@ extern_c_checked! {
pub struct GuestMaps {
orig_c_iter: *const c_void,
c_iter: *const c_void,
first_iter: bool,
}
// Consider a private new only for Emulator
@ -473,6 +474,7 @@ impl GuestMaps {
Self {
orig_c_iter: maps,
c_iter: maps,
first_iter: true,
}
}
}
@ -489,7 +491,10 @@ impl Iterator for GuestMaps {
}
unsafe {
let mut ret = MaybeUninit::uninit();
self.c_iter = libafl_maps_next(self.c_iter, ret.as_mut_ptr());
self.c_iter = libafl_maps_next(self.c_iter, ret.as_mut_ptr(), self.first_iter);
self.first_iter = false;
if self.c_iter.is_null() {
None
} else {