diff options
author | Dmitry Kovalenko <d.kovalenko@samsung.com> | 2013-07-25 16:02:05 +0400 |
---|---|---|
committer | Dmitry Kovalenko <d.kovalenko@samsung.com> | 2013-07-25 16:02:05 +0400 |
commit | 5b77fe7292839be13605d51e8c6d2d887de70233 (patch) | |
tree | 9bb2b4fc44d1a9dcb90b9bee582cc98fad96eb24 /kprobe | |
parent | 7414f0f6c7d26cc2b3d7d7aa1a0e12a97f92f211 (diff) | |
download | swap-modules-5b77fe7292839be13605d51e8c6d2d887de70233.tar.gz swap-modules-5b77fe7292839be13605d51e8c6d2d887de70233.tar.bz2 swap-modules-5b77fe7292839be13605d51e8c6d2d887de70233.zip |
[FIX] Separate probes disarming and recycling
Diffstat (limited to 'kprobe')
-rw-r--r-- | kprobe/dbi_kprobes.c | 24 | ||||
-rw-r--r-- | kprobe/dbi_kprobes.h | 3 |
2 files changed, 19 insertions, 8 deletions
diff --git a/kprobe/dbi_kprobes.c b/kprobe/dbi_kprobes.c index e5855bd2..b5905950 100644 --- a/kprobe/dbi_kprobes.c +++ b/kprobe/dbi_kprobes.c @@ -761,28 +761,37 @@ int dbi_register_kretprobe (struct kretprobe *rp) static int dbi_disarm_krp_inst(struct kretprobe_instance *ri); -void dbi_unregister_kretprobe (struct kretprobe *rp) +void dbi_unregister_kretprobe_top(struct kretprobe *rp) { unsigned long flags; struct kretprobe_instance *ri; + struct hlist_node *node; dbi_unregister_kprobe (&rp->kp, NULL); /* No race here */ spin_lock_irqsave (&kretprobe_lock, flags); - if ((unsigned long)rp->kp.addr == sched_addr) - sched_rp = NULL; - - while ((ri = get_used_rp_inst (rp)) != NULL) { + swap_hlist_for_each_entry(ri, node, &rp->used_instances, uflist) { if (!dbi_disarm_krp_inst(ri)) { printk("%s (%d/%d): cannot disarm krp instance (%08lx)\n", ri->task->comm, ri->task->tgid, ri->task->pid, (unsigned long)rp->kp.addr); } - recycle_rp_inst(ri); } + spin_unlock_irqrestore(&kretprobe_lock, flags); +} +void dbi_unregister_kretprobe_bottom(struct kretprobe *rp) +{ + unsigned long flags; + struct kretprobe_instance *ri; + struct hlist_node *node; + + spin_lock_irqsave(&kretprobe_lock, flags); + while ((ri = get_used_rp_inst (rp)) != NULL) { + recycle_rp_inst(ri); + } spin_unlock_irqrestore (&kretprobe_lock, flags); free_rp_inst (rp); } @@ -953,7 +962,8 @@ EXPORT_SYMBOL_GPL (dbi_register_jprobe); EXPORT_SYMBOL_GPL (dbi_unregister_jprobe); EXPORT_SYMBOL_GPL (dbi_jprobe_return); EXPORT_SYMBOL_GPL (dbi_register_kretprobe); -EXPORT_SYMBOL_GPL (dbi_unregister_kretprobe); +EXPORT_SYMBOL_GPL (dbi_unregister_kretprobe_top); +EXPORT_SYMBOL_GPL (dbi_unregister_kretprobe_bottom); MODULE_LICENSE ("Dual BSD/GPL"); diff --git a/kprobe/dbi_kprobes.h b/kprobe/dbi_kprobes.h index b5892f5f..c210348d 100644 --- a/kprobe/dbi_kprobes.h +++ b/kprobe/dbi_kprobes.h @@ -258,7 +258,8 @@ struct kretprobe_instance * get_used_rp_inst (struct kretprobe *rp); int alloc_nodes_kretprobe(struct kretprobe *rp); int dbi_register_kretprobe (struct kretprobe *rp); -void dbi_unregister_kretprobe (struct kretprobe *rp); +void dbi_unregister_kretprobe_top(struct kretprobe *rp); +void dbi_unregister_kretprobe_bottom(struct kretprobe *rp); void kretprobe_assert (struct kretprobe_instance *ri, unsigned long orig_ret_address, unsigned long trampoline_address); |