diff --git a/libafl_qemu/src/snapshot.rs b/libafl_qemu/src/snapshot.rs index deecf8775a..54a8ac4d4c 100644 --- a/libafl_qemu/src/snapshot.rs +++ b/libafl_qemu/src/snapshot.rs @@ -671,7 +671,7 @@ where h.access(a0 as GuestAddr, a1 as usize); } // mmap syscalls - _ => { + sys_const => { if result as GuestAddr == GuestAddr::MAX /* -1 */ { @@ -681,7 +681,7 @@ where // TODO handle huge pages #[cfg(any(cpu_target = "arm", cpu_target = "mips"))] - if i64::from(sys_num) == SYS_mmap2 { + if sys_const == SYS_mmap2 { if let Ok(prot) = MmapPerms::try_from(a2 as i32) { let h = hooks.match_helper_mut::().unwrap(); h.add_mapped(result as GuestAddr, a1 as usize, Some(prot)); @@ -689,24 +689,24 @@ where } #[cfg(not(cpu_target = "arm"))] - if i64::from(sys_num) == SYS_mmap { + if sys_const == SYS_mmap { if let Ok(prot) = MmapPerms::try_from(a2 as i32) { let h = hooks.match_helper_mut::().unwrap(); h.add_mapped(result as GuestAddr, a1 as usize, Some(prot)); } } - if i64::from(sys_num) == SYS_mremap { + if sys_const == SYS_mremap { let h = hooks.match_helper_mut::().unwrap(); + // TODO get the old permissions from the removed mapping h.remove_mapped(a0 as GuestAddr, a1 as usize); h.add_mapped(result as GuestAddr, a2 as usize, None); - // TODO get the old permissions from the removed mappin - } else if i64::from(sys_num) == SYS_mprotect { + } else if sys_const == SYS_mprotect { if let Ok(prot) = MmapPerms::try_from(a2 as i32) { let h = hooks.match_helper_mut::().unwrap(); h.add_mapped(a0 as GuestAddr, a1 as usize, Some(prot)); } - } else if i64::from(sys_num) == SYS_munmap { + } else if sys_const == SYS_munmap { let h = hooks.match_helper_mut::().unwrap(); if !h.accurate_unmap && !h.is_unmap_allowed(a0 as GuestAddr, a1 as usize) { h.remove_mapped(a0 as GuestAddr, a1 as usize);