[FIX] Uprobe: slot free for unfired uprobes 58/22458/7
authorAlexander Aksenov <a.aksenov@samsung.com>
Wed, 4 Jun 2014 10:31:19 +0000 (14:31 +0400)
committerAlexander Aksenov <a.aksenov@samsung.com>
Fri, 6 Jun 2014 07:03:39 +0000 (11:03 +0400)
Now it's arch dependent, cause way of slots allocation differs
from arch to arch

Change-Id: I60cc2c97b84756cff7022e6454cad9a1201e7550
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
uprobe/arch/asm-arm/swap_uprobes.c
uprobe/arch/asm-arm/swap_uprobes.h
uprobe/arch/asm-x86/swap_uprobes.c
uprobe/arch/asm-x86/swap_uprobes.h
uprobe/swap_uprobes.c

index 8a39906..ebbd797 100644 (file)
@@ -716,6 +716,11 @@ void arch_set_orig_ret_addr(unsigned long orig_ret_addr, struct pt_regs *regs)
                regs->ARM_cpsr &= ~PSR_T_BIT;
 }
 
+void arch_remove_uprobe(struct uprobe *up)
+{
+       swap_slot_free(up->sm, up->atramp.utramp);
+}
+
 static void restore_opcode_for_thumb(struct kprobe *p, struct pt_regs *regs)
 {
        if (thumb_mode(regs) && !is_thumb2(p->opcode)) {
index 8efb0e7..a89af74 100644 (file)
@@ -73,6 +73,7 @@ int arch_disarm_urp_inst(struct uretprobe_instance *ri,
 
 unsigned long arch_get_trampoline_addr(struct kprobe *p, struct pt_regs *regs);
 void arch_set_orig_ret_addr(unsigned long orig_ret_addr, struct pt_regs *regs);
+void arch_remove_uprobe(struct uprobe *up);
 
 static inline unsigned long swap_get_uarg(struct pt_regs *regs, unsigned long n)
 {
index 19ae1da..85a12aa 100644 (file)
@@ -180,6 +180,13 @@ void arch_set_orig_ret_addr(unsigned long orig_ret_addr, struct pt_regs *regs)
        regs->EREG(ip) = orig_ret_addr;
 }
 
+void arch_remove_uprobe(struct uprobe *up)
+{
+       struct kprobe *p = up2kp(up);
+
+       swap_slot_free(up->sm, p->ainsn.insn);
+}
+
 static void set_user_jmp_op(void *from, void *to)
 {
        struct __arch_jmp_op
index 100f263..a0ae4d4 100644 (file)
@@ -77,6 +77,7 @@ int arch_disarm_urp_inst(struct uretprobe_instance *ri,
                         struct task_struct *task);
 unsigned long arch_get_trampoline_addr(struct kprobe *p, struct pt_regs *regs);
 void arch_set_orig_ret_addr(unsigned long orig_ret_addr, struct pt_regs *regs);
+void arch_remove_uprobe(struct uprobe *up);
 
 static inline unsigned long swap_get_uarg(struct pt_regs *regs, unsigned long n)
 {
index 2d22754..7a5e277 100644 (file)
@@ -323,9 +323,7 @@ struct kprobe *get_ukprobe_by_insn_slot(void *addr, pid_t tgid, struct pt_regs *
 
 static void remove_uprobe(struct uprobe *up)
 {
-       struct kprobe *p = up2kp(up);
-
-       swap_slot_free(up->sm, p->ainsn.insn);
+       arch_remove_uprobe(up);
 }
 
 static struct hlist_head *uretprobe_inst_table_head(void *hash_key)