Fix build issues in frida cmplog for aarch64 (#1813)
* Fix build issues for aarch64 * cargo fmt
This commit is contained in:
parent
a0e30d01d3
commit
1458c3efff
@ -8,6 +8,8 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use dynasmrt::dynasm;
|
use dynasmrt::dynasm;
|
||||||
|
#[cfg(target_arch = "aarch64")]
|
||||||
|
use dynasmrt::{DynasmApi, DynasmLabelApi};
|
||||||
use libafl::{
|
use libafl::{
|
||||||
inputs::{HasTargetBytes, Input},
|
inputs::{HasTargetBytes, Input},
|
||||||
Error,
|
Error,
|
||||||
@ -21,6 +23,8 @@ extern "C" {
|
|||||||
pub fn __libafl_targets_cmplog_instructions(k: u64, shape: u8, arg1: u64, arg2: u64);
|
pub fn __libafl_targets_cmplog_instructions(k: u64, shape: u8, arg1: u64, arg2: u64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_arch = "aarch64")]
|
||||||
|
use core::ffi::c_void;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use frida_gum::ModuleMap;
|
use frida_gum::ModuleMap;
|
||||||
@ -105,9 +109,9 @@ pub enum CmplogOperandType {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
pub struct CmpLogRuntime {
|
pub struct CmpLogRuntime {
|
||||||
save_register_and_blr_to_populate: Option<Box<[u8]>>,
|
ops_save_register_and_blr_to_populate: Option<Box<[u8]>>,
|
||||||
handle_tbz_masking: Option<Box<[u8]>>,
|
ops_handle_tbz_masking: Option<Box<[u8]>>,
|
||||||
handle_tbnz_masking: Option<Box<[u8]>>,
|
ops_handle_tbnz_masking: Option<Box<[u8]>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `Frida`-based binary-only innstrumentation that logs compares to the fuzzer
|
/// `Frida`-based binary-only innstrumentation that logs compares to the fuzzer
|
||||||
@ -384,7 +388,7 @@ impl CmpLogRuntime {
|
|||||||
/// Get the blob which saves the context, jumps to the populate function and restores the context
|
/// Get the blob which saves the context, jumps to the populate function and restores the context
|
||||||
#[inline]
|
#[inline]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[cfg(target_arch = "aaarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
pub fn ops_save_register_and_blr_to_populate(&self) -> &[u8] {
|
pub fn ops_save_register_and_blr_to_populate(&self) -> &[u8] {
|
||||||
self.ops_save_register_and_blr_to_populate.as_ref().unwrap()
|
self.ops_save_register_and_blr_to_populate.as_ref().unwrap()
|
||||||
}
|
}
|
||||||
@ -392,7 +396,7 @@ impl CmpLogRuntime {
|
|||||||
/// Get the blob which handles the tbz opcode masking
|
/// Get the blob which handles the tbz opcode masking
|
||||||
#[inline]
|
#[inline]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[cfg(target_arch = "aaarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
pub fn ops_handle_tbz_masking(&self) -> &[u8] {
|
pub fn ops_handle_tbz_masking(&self) -> &[u8] {
|
||||||
self.ops_handle_tbz_masking.as_ref().unwrap()
|
self.ops_handle_tbz_masking.as_ref().unwrap()
|
||||||
}
|
}
|
||||||
@ -400,7 +404,7 @@ impl CmpLogRuntime {
|
|||||||
/// Get the blob which handles the tbnz opcode masking
|
/// Get the blob which handles the tbnz opcode masking
|
||||||
#[inline]
|
#[inline]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[cfg(target_arch = "aaarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
pub fn ops_handle_tbnz_masking(&self) -> &[u8] {
|
pub fn ops_handle_tbnz_masking(&self) -> &[u8] {
|
||||||
self.ops_handle_tbnz_masking.as_ref().unwrap()
|
self.ops_handle_tbnz_masking.as_ref().unwrap()
|
||||||
}
|
}
|
||||||
@ -557,6 +561,7 @@ impl CmpLogRuntime {
|
|||||||
writer.put_bytes(&self.restore_registers.clone().unwrap());
|
writer.put_bytes(&self.restore_registers.clone().unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Emit the instrumentation code which is responsible for operands value extraction and cmplog map population
|
||||||
#[cfg(all(feature = "cmplog", target_arch = "aarch64"))]
|
#[cfg(all(feature = "cmplog", target_arch = "aarch64"))]
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user