From e1eb097604371baef52f8964adbe8eed1c575a72 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalenko Date: Mon, 30 Jul 2012 09:14:37 +0400 Subject: [PATCH] Fixed handling of unsupported instruction instrumentation (#363) --- kprobe/arch/asm-arm/dbi_kprobes.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kprobe/arch/asm-arm/dbi_kprobes.c b/kprobe/arch/asm-arm/dbi_kprobes.c index 6905c84..1169e43 100644 --- a/kprobe/arch/asm-arm/dbi_kprobes.c +++ b/kprobe/arch/asm-arm/dbi_kprobes.c @@ -80,6 +80,10 @@ EXPORT_SYMBOL_GPL (swap_sum_time); EXPORT_SYMBOL_GPL (swap_sum_hit); #endif +#define sign_extend(x, signbit) ((x) | (0 - ((x) & (1 << (signbit))))) +#define branch_displacement(insn) sign_extend(((insn) & 0xffffff) << 2, 25) + + unsigned int arr_traps_template[] = { 0xe1a0c00d, // mov ip, sp 0xe92dd800, // stmdb sp!, {fp, ip, lr, pc} @@ -1059,11 +1063,9 @@ int kprobe_handler (struct pt_regs *regs) } else { printk("Error in %s at %d: we are in thumb mode (!) and check instruction was fail \ - (%0X instruction at %p address)!\n", __FILE__, __LINE__, pop->addr, pop->opcode); + (%0X instruction at %p address)!\n", __FILE__, __LINE__, pop->opcode, pop->addr); // Test case when we do our actions on already running application arch_disarm_uprobe (pop, current); - // up on one instruction - regs->uregs[15] -= 2; goto no_kprobe_live; } } @@ -1076,11 +1078,9 @@ int kprobe_handler (struct pt_regs *regs) } else { printk("Error in %s at %d: we are in arm mode (!) and check instruction was fail \ - (%0X instruction at %p address)!\n", __FILE__, __LINE__, pop->addr, pop->opcode); + (%0X instruction at %p address)!\n", __FILE__, __LINE__, pop->opcode, pop->addr ); // Test case when we do our actions on already running application arch_disarm_uprobe (pop, current); - // up on one instruction - regs->uregs[15] -= 4; goto no_kprobe_live; } } -- 2.7.4