Fix cfg directives for frida-asan (#365)

* Fix cfg directives for frida-asan

* drop unneeded line

* clippy

Co-authored-by: Dominik Maier <domenukk@gmail.com>
This commit is contained in:
s1341 2021-11-07 19:17:47 +02:00 committed by GitHub
parent bd7ce8d0ca
commit a80126681e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -64,6 +64,7 @@ const ANONYMOUS_FLAG: MapFlags = MapFlags::MAP_ANONYMOUS;
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
pub const ASAN_SAVE_REGISTER_COUNT: usize = 19; pub const ASAN_SAVE_REGISTER_COUNT: usize = 19;
#[cfg(target_arch = "x86_64")]
pub const ASAN_SAVE_REGISTER_NAMES: [&str; ASAN_SAVE_REGISTER_COUNT] = [ pub const ASAN_SAVE_REGISTER_NAMES: [&str; ASAN_SAVE_REGISTER_COUNT] = [
"rax", "rax",
"rbx", "rbx",
@ -86,7 +87,7 @@ pub const ASAN_SAVE_REGISTER_NAMES: [&str; ASAN_SAVE_REGISTER_COUNT] = [
"actual rip", "actual rip",
]; ];
#[cfg(tareget_arch = "aarch64")] #[cfg(target_arch = "aarch64")]
pub const ASAN_SAVE_REGISTER_COUNT: usize = 32; pub const ASAN_SAVE_REGISTER_COUNT: usize = 32;
/// The frida address sanitizer runtime, providing address sanitization. /// The frida address sanitizer runtime, providing address sanitization.
@ -1959,7 +1960,7 @@ impl AsanRuntime {
3, 3,
) )
.unwrap(); .unwrap();
let instructions = instructions.iter().collect::<Vec<Insn>>(); let instructions = instructions.iter().collect::<Vec<&Insn>>();
let mut insn = instructions.first().unwrap(); let mut insn = instructions.first().unwrap();
if insn.mnemonic().unwrap() == "msr" && insn.op_str().unwrap() == "nzcv, x0" { if insn.mnemonic().unwrap() == "msr" && insn.op_str().unwrap() == "nzcv, x0" {
insn = instructions.get(2).unwrap(); insn = instructions.get(2).unwrap();

View File

@ -62,12 +62,13 @@ enum CmplogOperandType {
Mem(capstone::RegId, capstone::RegId, i32, u32), Mem(capstone::RegId, capstone::RegId, i32, u32),
} }
#[cfg(all(feature = "cmplog", target_arch = "aarch64"))]
enum SpecialCmpLogCase { enum SpecialCmpLogCase {
Tbz, Tbz,
Tbnz, Tbnz,
} }
#[cfg(any(target_vendor = "apple"))] #[cfg(target_vendor = "apple")]
const ANONYMOUS_FLAG: MapFlags = MapFlags::MAP_ANON; const ANONYMOUS_FLAG: MapFlags = MapFlags::MAP_ANON;
#[cfg(not(any(target_vendor = "apple", target_os = "windows")))] #[cfg(not(any(target_vendor = "apple", target_os = "windows")))]
const ANONYMOUS_FLAG: MapFlags = MapFlags::MAP_ANONYMOUS; const ANONYMOUS_FLAG: MapFlags = MapFlags::MAP_ANONYMOUS;