Fixed bug of segfaulting Thumb apps (retprobe)
authorNikita Kalyazin <n.kalyazin@samsung.com>
Thu, 22 Sep 2011 06:50:26 +0000 (10:50 +0400)
committerNikita Kalyazin <n.kalyazin@samsung.com>
Thu, 22 Sep 2011 06:50:26 +0000 (10:50 +0400)
This is the same as b74f1859918bc25c2a1cd4ebcfad8b49ec6b831a, but for retprobes.

kprobe/arch/asm-arm/dbi_kprobes.c
kprobe/arch/asm-arm/dbi_kprobes_thumb.S

index 04ec080..f1b4d36 100644 (file)
@@ -968,7 +968,7 @@ int arch_copy_trampoline_thumb_uprobe (struct kprobe *p, struct task_struct *tas
                                }
                                addr = ((unsigned int)p->addr) + 4;
 
-                               *((unsigned short*)insns + 13) = 0xffff;
+                               *((unsigned short*)insns + 13) = 0xdeff;
                                *((unsigned short*)insns + 14) = addr & 0x0000ffff;
                                *((unsigned short*)insns + 15) = addr >> 16;
 
@@ -987,7 +987,7 @@ int arch_copy_trampoline_thumb_uprobe (struct kprobe *p, struct task_struct *tas
                        }else{
                                memcpy (insns, gen_insn_execbuf_thumb, 18 * 2);
 
-                               *((unsigned short*)insns + 13) = 0xffff;
+                               *((unsigned short*)insns + 13) = 0xdeff;
 
                                if (!isThumb2(insn[0]))
                                {
index e48b5ec..94ba3dd 100644 (file)
@@ -24,6 +24,7 @@ gen_insn_execbuf_thumb:
                nop
 
                .global pc_dep_insn_execbuf_thumb
+               .align 4
 pc_dep_insn_execbuf_thumb:
                push    {r6, r7}
                ldr     r6, i1
@@ -39,7 +40,7 @@ pc_dep_insn_execbuf_thumb:
                str     r0, [sp, #4]
                pop     {r0, pc}        // ssbreak
                nop                     // retbreak
-               nop                     // stored PC hi
-i1:            nop                     // stored PC lo
-               nop                     // stored PC-4(next insn addr) hi
-i2:            nop                     // stored PC-4(next insn addr) lo
+i1:            nop                     // stored PC hi
+               nop                     // stored PC lo
+i2:            nop                     // stored PC-4(next insn addr) hi
+               nop                     // stored PC-4(next insn addr) lo