aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/kprobes.c
diff options
context:
space:
mode:
authorAbhishek Sagar <sagar.abhishek@gmail.com>2008-02-06 04:38:22 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:11 -0500
commitf47cd9b553aaada602449204513b5a5b29cba263 (patch)
tree079ddd399b1aa00a8c413ef51f3b8681a19a6e7e /kernel/kprobes.c
parent5beec4aa2ac261b0b4992fb41df40a7ab91e4fad (diff)
kprobes: kretprobe user entry-handler
Provide support to add an optional user defined callback to be run at function entry of a kretprobe'd function. Also modify the kprobe smoke tests to include an entry-handler during the kretprobe sanity test. Signed-off-by: Abhishek Sagar <sagar.abhishek@gmail.com> Cc: Prasanna S Panchamukhi <prasanna@in.ibm.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Acked-by: Jim Keniston <jkenisto@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/kprobes.c')
-rw-r--r--kernel/kprobes.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index d0493eafea3e..7a86e6432338 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -699,6 +699,12 @@ static int __kprobes pre_handler_kretprobe(struct kprobe *p,
699 struct kretprobe_instance, uflist); 699 struct kretprobe_instance, uflist);
700 ri->rp = rp; 700 ri->rp = rp;
701 ri->task = current; 701 ri->task = current;
702
703 if (rp->entry_handler && rp->entry_handler(ri, regs)) {
704 spin_unlock_irqrestore(&kretprobe_lock, flags);
705 return 0;
706 }
707
702 arch_prepare_kretprobe(ri, regs); 708 arch_prepare_kretprobe(ri, regs);
703 709
704 /* XXX(hch): why is there no hlist_move_head? */ 710 /* XXX(hch): why is there no hlist_move_head? */
@@ -745,7 +751,8 @@ int __kprobes register_kretprobe(struct kretprobe *rp)
745 INIT_HLIST_HEAD(&rp->used_instances); 751 INIT_HLIST_HEAD(&rp->used_instances);
746 INIT_HLIST_HEAD(&rp->free_instances); 752 INIT_HLIST_HEAD(&rp->free_instances);
747 for (i = 0; i < rp->maxactive; i++) { 753 for (i = 0; i < rp->maxactive; i++) {
748 inst = kmalloc(sizeof(struct kretprobe_instance), GFP_KERNEL); 754 inst = kmalloc(sizeof(struct kretprobe_instance) +
755 rp->data_size, GFP_KERNEL);
749 if (inst == NULL) { 756 if (inst == NULL) {
750 free_rp_inst(rp); 757 free_rp_inst(rp);
751 return -ENOMEM; 758 return -ENOMEM;