Skip to content

Commit 7f06e36

Browse files
domenukkandreafioraldi
authored andcommitted
Remove get prefix from frida functions (#93)
* more docs * more docs: * more docu * more docu * finished docs * cleaned up markup * must_use tags added * more docs * cleanup get
1 parent 8bb061f commit 7f06e36

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

libafl_frida/src/asan_rt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ pub extern "C" fn asan_mallinfo() -> *mut c_void {
612612

613613
/// Get the current thread's TLS address
614614
extern "C" {
615-
fn get_tls_ptr() -> *const c_void;
615+
fn tls_ptr() -> *const c_void;
616616
}
617617

618618
/// The frida address sanitizer runtime, providing address sanitization.
@@ -892,7 +892,7 @@ impl AsanRuntime {
892892

893893
/// Determine the tls start, end for the currently running thread
894894
fn current_tls() -> (usize, usize) {
895-
let tls_address = unsafe { get_tls_ptr() } as usize;
895+
let tls_address = unsafe { tls_ptr() } as usize;
896896
// we need to mask off the highest byte, due to 'High Byte Ignore"
897897
#[cfg(target_os = "android")]
898898
let tls_address = tls_address & 0xffffffffffffff;

libafl_frida/src/gettls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ __declspec( thread ) int i = 0;
44
__thread int i = 0;
55
#endif
66

7-
void * get_tls_ptr() {
7+
void * tls_ptr() {
88
return (void*)&i;
99
}

libafl_frida/src/helper.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ const MAYBE_LOG_CODE: [u8; 60] = [
193193
];
194194

195195
#[cfg(target_arch = "aarch64")]
196-
fn get_pc(context: &CpuContext) -> usize {
196+
fn pc(context: &CpuContext) -> usize {
197197
context.pc() as usize
198198
}
199199

200200
#[cfg(target_arch = "x86_64")]
201-
fn get_pc(context: &CpuContext) -> usize {
201+
fn pc(context: &CpuContext) -> usize {
202202
context.rip() as usize
203203
}
204204

@@ -284,10 +284,10 @@ impl<'a> FridaInstrumentationHelper<'a> {
284284
let real_address = match helper
285285
.asan_runtime
286286
.borrow()
287-
.real_address_for_stalked(get_pc(&context))
287+
.real_address_for_stalked(pc(&context))
288288
{
289289
Some(address) => *address,
290-
None => get_pc(&context),
290+
None => pc(&context),
291291
};
292292
//let (range, (id, name)) = helper.ranges.get_key_value(&real_address).unwrap();
293293
//println!("{}:0x{:016x}", name, real_address - range.start);
@@ -341,7 +341,7 @@ impl<'a> FridaInstrumentationHelper<'a> {
341341
}
342342
#[cfg(target_arch = "aarch64")]
343343
#[inline]
344-
fn get_writer_register(&self, reg: capstone::RegId) -> Aarch64Register {
344+
fn writer_register(&self, reg: capstone::RegId) -> Aarch64Register {
345345
let regint: u16 = reg.0;
346346
Aarch64Register::from_u32(regint as u32).unwrap()
347347
}
@@ -361,9 +361,9 @@ impl<'a> FridaInstrumentationHelper<'a> {
361361
) {
362362
let writer = output.writer();
363363

364-
let basereg = self.get_writer_register(basereg);
364+
let basereg = self.writer_register(basereg);
365365
let indexreg = if indexreg.0 != 0 {
366-
Some(self.get_writer_register(indexreg))
366+
Some(self.writer_register(indexreg))
367367
} else {
368368
None
369369
};
@@ -556,7 +556,7 @@ impl<'a> FridaInstrumentationHelper<'a> {
556556

557557
#[cfg(target_arch = "aarch64")]
558558
#[inline]
559-
fn get_instruction_width(&self, instr: &Insn, operands: &Vec<arch::ArchOperand>) -> u32 {
559+
fn instruction_width(&self, instr: &Insn, operands: &Vec<arch::ArchOperand>) -> u32 {
560560
use capstone::arch::arm64::Arm64Insn as I;
561561
use capstone::arch::arm64::Arm64Reg as R;
562562
use capstone::arch::arm64::Arm64Vas as V;
@@ -662,7 +662,7 @@ impl<'a> FridaInstrumentationHelper<'a> {
662662
opmem.base(),
663663
opmem.index(),
664664
opmem.disp(),
665-
self.get_instruction_width(instr, &operands),
665+
self.instruction_width(instr, &operands),
666666
arm64operand.shift,
667667
arm64operand.ext,
668668
));

0 commit comments

Comments
 (0)