diff options
author | Alexander Aksenov <a.aksenov@samsung.com> | 2014-06-04 14:31:19 +0400 |
---|---|---|
committer | Alexander Aksenov <a.aksenov@samsung.com> | 2014-06-06 11:03:39 +0400 |
commit | 9170e55ba6969e748a56306b80ff1183fa124ce5 (patch) | |
tree | c0f6e4ef59419107caa17a394b38e8bde14f3cc9 | |
parent | 6a1dd1a74febc89ba367bd65bdc5bb02394de5cf (diff) | |
download | swap-modules-9170e55ba6969e748a56306b80ff1183fa124ce5.tar.gz swap-modules-9170e55ba6969e748a56306b80ff1183fa124ce5.tar.bz2 swap-modules-9170e55ba6969e748a56306b80ff1183fa124ce5.zip |
[FIX] Uprobe: slot free for unfired uprobes
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>
-rw-r--r-- | uprobe/arch/asm-arm/swap_uprobes.c | 5 | ||||
-rw-r--r-- | uprobe/arch/asm-arm/swap_uprobes.h | 1 | ||||
-rw-r--r-- | uprobe/arch/asm-x86/swap_uprobes.c | 7 | ||||
-rw-r--r-- | uprobe/arch/asm-x86/swap_uprobes.h | 1 | ||||
-rw-r--r-- | uprobe/swap_uprobes.c | 4 |
5 files changed, 15 insertions, 3 deletions
diff --git a/uprobe/arch/asm-arm/swap_uprobes.c b/uprobe/arch/asm-arm/swap_uprobes.c index 8a39906e..ebbd7973 100644 --- a/uprobe/arch/asm-arm/swap_uprobes.c +++ b/uprobe/arch/asm-arm/swap_uprobes.c @@ -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)) { diff --git a/uprobe/arch/asm-arm/swap_uprobes.h b/uprobe/arch/asm-arm/swap_uprobes.h index 8efb0e74..a89af747 100644 --- a/uprobe/arch/asm-arm/swap_uprobes.h +++ b/uprobe/arch/asm-arm/swap_uprobes.h @@ -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) { diff --git a/uprobe/arch/asm-x86/swap_uprobes.c b/uprobe/arch/asm-x86/swap_uprobes.c index 19ae1dac..85a12aa3 100644 --- a/uprobe/arch/asm-x86/swap_uprobes.c +++ b/uprobe/arch/asm-x86/swap_uprobes.c @@ -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 diff --git a/uprobe/arch/asm-x86/swap_uprobes.h b/uprobe/arch/asm-x86/swap_uprobes.h index 100f2634..a0ae4d4c 100644 --- a/uprobe/arch/asm-x86/swap_uprobes.h +++ b/uprobe/arch/asm-x86/swap_uprobes.h @@ -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) { diff --git a/uprobe/swap_uprobes.c b/uprobe/swap_uprobes.c index 2d22754b..7a5e2779 100644 --- a/uprobe/swap_uprobes.c +++ b/uprobe/swap_uprobes.c @@ -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) |