4 * Kernel Probes (KProbes)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * Copyright (C) IBM Corporation, 2002, 2004
25 * Dynamic Binary Instrumentation Module based on KProbes
26 * modules/kprobe/dbi_kprobes.h
28 * This program is free software; you can redistribute it and/or modify
29 * it under the terms of the GNU General Public License as published by
30 * the Free Software Foundation; either version 2 of the License, or
31 * (at your option) any later version.
33 * This program is distributed in the hope that it will be useful,
34 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 * GNU General Public License for more details.
38 * You should have received a copy of the GNU General Public License
39 * along with this program; if not, write to the Free Software
40 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
42 * Copyright (C) Samsung Electronics, 2006-2010
44 * 2006-2007 Ekaterina Gorelkina <e.gorelkina@samsung.com>: initial implementation for ARM and MIPS
45 * 2008-2009 Alexey Gerenkov <a.gerenkov@samsung.com> User-Space
46 * Probes initial implementation; Support x86/ARM/MIPS for both user and kernel spaces.
47 * 2010 Ekaterina Gorelkina <e.gorelkina@samsung.com>: redesign module for separating core and arch parts
51 #include "dbi_kprobes.h"
52 #include "arch/dbi_kprobes.h"
53 #include "arch/asm/dbi_kprobes.h"
55 #include "dbi_kdebug.h"
56 #include "dbi_kprobes_deps.h"
57 #include "dbi_insn_slots.h"
58 #include "dbi_uprobes.h"
61 #include <linux/version.h>
62 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
63 #include <linux/config.h>
66 #include <linux/hash.h>
67 #include <linux/module.h>
69 #include <linux/pagemap.h>
73 extern unsigned int *sched_addr;
74 extern unsigned int *fork_addr;
75 extern struct hlist_head kprobe_insn_pages;
77 extern unsigned long (*kallsyms_search) (const char *name);
79 DEFINE_PER_CPU (struct kprobe *, current_kprobe) = NULL;
80 DEFINE_PER_CPU (struct kprobe_ctlblk, kprobe_ctlblk);
82 DEFINE_SPINLOCK (kretprobe_lock); /* Protects kretprobe_inst_table */
83 DEFINE_PER_CPU (struct kprobe *, kprobe_instance) = NULL;
85 struct hlist_head kprobe_table[KPROBE_TABLE_SIZE];
86 struct hlist_head kretprobe_inst_table[KPROBE_TABLE_SIZE];
88 atomic_t kprobe_count;
91 void kretprobe_assert (struct kretprobe_instance *ri, unsigned long orig_ret_address, unsigned long trampoline_address)
93 if (!orig_ret_address || (orig_ret_address == trampoline_address))
94 panic ("kretprobe BUG!: Processing kretprobe %p @ %p (%d/%d - %s)\n",
95 ri->rp, ri->rp->kp.addr, ri->task->tgid, ri->task->pid, ri->task->comm);
99 /* We have preemption disabled.. so it is safe to use __ versions */
101 void set_kprobe_instance (struct kprobe *kp)
103 __get_cpu_var (kprobe_instance) = kp;
107 void reset_kprobe_instance (void)
109 __get_cpu_var (kprobe_instance) = NULL;
112 /* kprobe_running() will just return the current_kprobe on this CPU */
113 struct kprobe *kprobe_running (void)
115 return (__get_cpu_var (current_kprobe));
118 void reset_current_kprobe (void)
120 __get_cpu_var (current_kprobe) = NULL;
123 struct kprobe_ctlblk *get_kprobe_ctlblk (void)
125 return (&__get_cpu_var (kprobe_ctlblk));
129 * This routine is called either:
130 * - under the kprobe_mutex - during kprobe_[un]register()
132 * - with preemption disabled - from arch/xxx/kernel/kprobes.c
134 struct kprobe *get_kprobe(kprobe_opcode_t *addr, pid_t tgid)
136 struct hlist_head *head;
137 struct hlist_node *node;
138 struct kprobe *p, *retVal = NULL;
140 head = &kprobe_table[hash_ptr (addr, KPROBE_HASH_BITS)];
141 hlist_for_each_entry_rcu(p, node, head, hlist) {
142 if (p->addr == addr && p->tgid == tgid) {
148 DBPRINTF ("get_kprobe: probe %p", retVal);
153 * Aggregate handlers for multiple kprobes support - these handlers
154 * take care of invoking the individual kprobe handlers on p->list
157 int aggr_pre_handler (struct kprobe *p, struct pt_regs *regs)
162 list_for_each_entry_rcu (kp, &p->list, list)
166 set_kprobe_instance (kp);
167 ret = kp->pre_handler (kp, regs);
171 reset_kprobe_instance ();
177 void aggr_post_handler (struct kprobe *p, struct pt_regs *regs, unsigned long flags)
181 list_for_each_entry_rcu (kp, &p->list, list)
183 if (kp->post_handler)
185 set_kprobe_instance (kp);
186 kp->post_handler (kp, regs, flags);
187 reset_kprobe_instance ();
193 int aggr_fault_handler (struct kprobe *p, struct pt_regs *regs, int trapnr)
195 struct kprobe *cur = __get_cpu_var (kprobe_instance);
198 * if we faulted "during" the execution of a user specified
199 * probe handler, invoke just that probe's fault handler
201 if (cur && cur->fault_handler)
203 if (cur->fault_handler (cur, regs, trapnr))
210 int aggr_break_handler (struct kprobe *p, struct pt_regs *regs)
212 struct kprobe *cur = __get_cpu_var (kprobe_instance);
214 DBPRINTF ("cur = 0x%p\n", cur);
216 DBPRINTF ("cur = 0x%p cur->break_handler = 0x%p\n", cur, cur->break_handler);
218 if (cur && cur->break_handler)
220 if (cur->break_handler (cur, regs /*, vma, page, kaddr */ ))
223 reset_kprobe_instance ();
227 /* Walks the list and increments nmissed count for multiprobe case */
228 void kprobes_inc_nmissed_count (struct kprobe *p)
231 if (p->pre_handler != aggr_pre_handler)
237 list_for_each_entry_rcu (kp, &p->list, list) kp->nmissed++;
242 /* Called with kretprobe_lock held */
243 struct kretprobe_instance *get_free_rp_inst (struct kretprobe *rp)
245 struct hlist_node *node;
246 struct kretprobe_instance *ri;
247 hlist_for_each_entry (ri, node, &rp->free_instances, uflist)
249 if(!alloc_nodes_kretprobe(rp)){
250 hlist_for_each_entry (ri, node, &rp->free_instances, uflist)
256 /* Called with kretprobe_lock held */
257 struct kretprobe_instance *get_free_rp_inst_no_alloc (struct kretprobe *rp)
259 struct hlist_node *node;
260 struct kretprobe_instance *ri;
261 hlist_for_each_entry (ri, node, &rp->free_instances, uflist)
266 /* Called with kretprobe_lock held */
267 struct kretprobe_instance *get_used_rp_inst (struct kretprobe *rp)
269 struct hlist_node *node;
270 struct kretprobe_instance *ri;
271 hlist_for_each_entry (ri, node, &rp->used_instances, uflist) return ri;
275 /* Called with kretprobe_lock held */
276 void add_rp_inst (struct kretprobe_instance *ri)
279 * Remove rp inst off the free list -
280 * Add it back when probed function returns
282 hlist_del (&ri->uflist);
284 /* Add rp inst onto table */
285 INIT_HLIST_NODE (&ri->hlist);
287 * We are using different hash keys (task and mm) for finding kernel
288 * space and user space probes. Kernel space probes can change mm field in
289 * task_struct. User space probes can be shared between threads of one
290 * process so they have different task but same mm.
292 if (ri->rp->kp.tgid) {
293 hlist_add_head (&ri->hlist, &kretprobe_inst_table[hash_ptr (ri->task->mm, KPROBE_HASH_BITS)]);
295 hlist_add_head (&ri->hlist, &kretprobe_inst_table[hash_ptr (ri->task, KPROBE_HASH_BITS)]);
298 /* Also add this rp inst to the used list. */
299 INIT_HLIST_NODE (&ri->uflist);
300 hlist_add_head (&ri->uflist, &ri->rp->used_instances);
303 /* Called with kretprobe_lock held */
304 void recycle_rp_inst (struct kretprobe_instance *ri)
308 hlist_del (&ri->hlist);
309 /* remove rp inst off the used list */
310 hlist_del (&ri->uflist);
311 /* put rp inst back onto the free list */
312 INIT_HLIST_NODE (&ri->uflist);
313 hlist_add_head (&ri->uflist, &ri->rp->free_instances);
314 } else if (!ri->rp2) {
316 * This is __switch_to retprobe instance. It has neither rp nor rp2.
318 hlist_del (&ri->hlist);
322 struct hlist_head * kretprobe_inst_table_head (void *hash_key)
324 return &kretprobe_inst_table[hash_ptr (hash_key, KPROBE_HASH_BITS)];
327 void free_rp_inst (struct kretprobe *rp)
329 struct kretprobe_instance *ri;
330 while ((ri = get_free_rp_inst_no_alloc (rp)) != NULL)
332 hlist_del (&ri->uflist);
338 * Keep all fields in the kprobe consistent
341 void copy_kprobe (struct kprobe *old_p, struct kprobe *p)
343 memcpy (&p->opcode, &old_p->opcode, sizeof (kprobe_opcode_t));
344 memcpy (&p->ainsn, &old_p->ainsn, sizeof (struct arch_specific_insn));
345 p->tgid = old_p->tgid;
346 p->ss_addr = old_p->ss_addr;
348 p->safe_arm = old_p->safe_arm;
349 p->safe_thumb = old_p->safe_thumb;
351 //p->spid = old_p->spid;
355 * Add the new probe to old_p->list. Fail if this is the
356 * second jprobe at the address - two jprobes can't coexist
358 int add_new_kprobe (struct kprobe *old_p, struct kprobe *p)
360 if (p->break_handler)
362 if (old_p->break_handler)
364 list_add_tail_rcu (&p->list, &old_p->list);
365 old_p->break_handler = aggr_break_handler;
368 list_add_rcu (&p->list, &old_p->list);
369 if (p->post_handler && !old_p->post_handler)
370 old_p->post_handler = aggr_post_handler;
375 * hlist_replace_rcu - replace old entry by new one
376 * @old : the element to be replaced
377 * @new : the new element to insert
379 * The @old entry will be replaced with the @new entry atomically.
381 inline void dbi_hlist_replace_rcu (struct hlist_node *old, struct hlist_node *new)
383 struct hlist_node *next = old->next;
386 new->pprev = old->pprev;
389 new->next->pprev = &new->next;
392 old->pprev = LIST_POISON2;
397 * Fill in the required fields of the "manager kprobe". Replace the
398 * earlier kprobe in the hlist with the manager kprobe
401 void add_aggr_kprobe (struct kprobe *ap, struct kprobe *p)
404 //flush_insn_slot (ap);
406 ap->pre_handler = aggr_pre_handler;
407 ap->fault_handler = aggr_fault_handler;
409 ap->post_handler = aggr_post_handler;
410 if (p->break_handler)
411 ap->break_handler = aggr_break_handler;
413 INIT_LIST_HEAD (&ap->list);
414 list_add_rcu (&p->list, &ap->list);
416 dbi_hlist_replace_rcu (&p->hlist, &ap->hlist);
420 * This is the second or subsequent kprobe at the address - handle
423 int register_aggr_kprobe (struct kprobe *old_p, struct kprobe *p)
427 DBPRINTF ("start\n");
429 DBPRINTF ("p = %p old_p = %p \n", p, old_p);
430 if (old_p->pre_handler == aggr_pre_handler)
432 DBPRINTF ("aggr_pre_handler \n");
434 copy_kprobe (old_p, p);
435 ret = add_new_kprobe (old_p, p);
439 DBPRINTF ("kzalloc\n");
442 ap = kzalloc (sizeof (struct kprobe), GFP_KERNEL);
444 ap = kmalloc (sizeof (struct kprobe), GFP_KERNEL);
446 memset (ap, 0, sizeof (struct kprobe));
450 add_aggr_kprobe (ap, old_p);
452 DBPRINTF ("ap = %p p = %p old_p = %p \n", ap, p, old_p);
453 ret = add_new_kprobe (ap, p);
458 int dbi_register_kprobe (struct kprobe *p)
460 struct kprobe *old_p;
463 * If we have a symbol_name argument look it up,
464 * and add it to the address. That way the addr
465 * field can either be global or relative to a symbol.
471 p->addr = (unsigned int) kallsyms_search (p->symbol_name);
476 DBPRINTF ("p->addr = 0x%p\n", p->addr);
477 p->addr = (kprobe_opcode_t *) (((char *) p->addr) + p->offset);
478 DBPRINTF ("p->addr = 0x%p p = 0x%p\n", p->addr, p);
480 #ifdef KPROBES_PROFILE
481 p->start_tm.tv_sec = p->start_tm.tv_usec = 0;
482 p->hnd_tm_sum.tv_sec = p->hnd_tm_sum.tv_usec = 0;
485 p->mod_refcounted = 0;
488 old_p = get_kprobe(p->addr, 0);
491 ret = register_aggr_kprobe (old_p, p);
493 atomic_inc (&kprobe_count);
497 if ((ret = arch_prepare_kprobe (p)) != 0)
500 DBPRINTF ("before out ret = 0x%x\n", ret);
501 INIT_HLIST_NODE (&p->hlist);
502 hlist_add_head_rcu (&p->hlist, &kprobe_table[hash_ptr (p->addr, KPROBE_HASH_BITS)]);
506 DBPRINTF ("out ret = 0x%x\n", ret);
510 void dbi_unregister_kprobe (struct kprobe *p, struct task_struct *task)
512 struct kprobe *old_p, *list_p;
513 int cleanup_p, pid = p->tgid;
515 old_p = get_kprobe(p->addr, pid);
516 DBPRINTF ("dbi_unregister_kprobe p=%p old_p=%p", p, old_p);
517 if (unlikely (!old_p))
522 list_for_each_entry_rcu (list_p, &old_p->list, list)
524 /* kprobe p is a valid probe */
530 DBPRINTF ("dbi_unregister_kprobe valid_p");
531 if ((old_p == p) || ((old_p->pre_handler == aggr_pre_handler) &&
532 (p->list.next == &old_p->list) && (p->list.prev == &old_p->list)))
534 /* Only probe on the hash list */
535 DBPRINTF ("dbi_unregister_kprobe disarm pid=%d", pid);
537 arch_disarm_uprobe (p, task);//vma, page, kaddr);
539 arch_disarm_kprobe (p);
540 hlist_del_rcu (&old_p->hlist);
545 list_del_rcu (&p->list);
548 DBPRINTF ("dbi_unregister_kprobe cleanup_p=%d", cleanup_p);
554 list_del_rcu (&p->list);
557 arch_remove_kprobe (p, task);
561 if (p->break_handler)
562 old_p->break_handler = NULL;
565 list_for_each_entry_rcu (list_p, &old_p->list, list)
567 if (list_p->post_handler)
574 old_p->post_handler = NULL;
579 int dbi_register_jprobe (struct jprobe *jp)
581 /* Todo: Verify probepoint is a function entry point */
582 jp->kp.pre_handler = setjmp_pre_handler;
583 jp->kp.break_handler = longjmp_break_handler;
585 return dbi_register_kprobe (&jp->kp);
588 void dbi_unregister_jprobe (struct jprobe *jp)
590 dbi_unregister_kprobe (&jp->kp, 0);
594 * This kprobe pre_handler is registered with every kretprobe. When probe
595 * hits it will set up the return probe.
597 int pre_handler_kretprobe (struct kprobe *p, struct pt_regs *regs)
599 struct kretprobe *rp = container_of (p, struct kretprobe, kp);
600 unsigned long flags = 0;
601 DBPRINTF ("START\n");
603 /*TODO: consider to only swap the RA after the last pre_handler fired */
604 spin_lock_irqsave (&kretprobe_lock, flags);
606 __arch_prepare_kretprobe (rp, regs);
607 spin_unlock_irqrestore (&kretprobe_lock, flags);
612 struct kretprobe *sched_rp;
614 #define SCHED_RP_NR 200
615 #define COMMON_RP_NR 10
617 int alloc_nodes_kretprobe(struct kretprobe *rp)
620 struct kretprobe_instance *inst;
623 DBPRINTF("Alloc aditional mem for retprobes");
625 if((unsigned int)rp->kp.addr == sched_addr){
626 rp->maxactive += SCHED_RP_NR;//max (100, 2 * NR_CPUS);
627 alloc_nodes = SCHED_RP_NR;
631 #if 1//def CONFIG_PREEMPT
632 rp->maxactive += max (COMMON_RP_NR, 2 * NR_CPUS);
634 rp->maxacpptive += NR_CPUS;
636 alloc_nodes = COMMON_RP_NR;
638 /* INIT_HLIST_HEAD (&rp->used_instances); */
639 /* INIT_HLIST_HEAD (&rp->free_instances); */
640 for (i = 0; i < alloc_nodes; i++)
642 inst = kmalloc (sizeof (struct kretprobe_instance), GFP_ATOMIC);
648 INIT_HLIST_NODE (&inst->uflist);
649 hlist_add_head (&inst->uflist, &rp->free_instances);
652 DBPRINTF ("addr=%p, *addr=[%lx %lx %lx]", rp->kp.addr, (unsigned long) (*(rp->kp.addr)), (unsigned long) (*(rp->kp.addr + 1)), (unsigned long) (*(rp->kp.addr + 2)));
656 int dbi_register_kretprobe (struct kretprobe *rp)
659 struct kretprobe_instance *inst;
663 rp->kp.pre_handler = pre_handler_kretprobe;
664 rp->kp.post_handler = NULL;
665 rp->kp.fault_handler = NULL;
666 rp->kp.break_handler = NULL;
670 /* Pre-allocate memory for max kretprobe instances */
671 if((unsigned int)rp->kp.addr == sched_addr)
672 rp->maxactive = SCHED_RP_NR;//max (100, 2 * NR_CPUS);
673 else if (rp->maxactive <= 0)
675 #if 1//def CONFIG_PREEMPT
676 rp->maxactive = max (COMMON_RP_NR, 2 * NR_CPUS);
678 rp->maxactive = NR_CPUS;
681 INIT_HLIST_HEAD (&rp->used_instances);
682 INIT_HLIST_HEAD (&rp->free_instances);
683 for (i = 0; i < rp->maxactive; i++)
685 inst = kmalloc (sizeof (struct kretprobe_instance), GFP_KERNEL);
691 INIT_HLIST_NODE (&inst->uflist);
692 hlist_add_head (&inst->uflist, &rp->free_instances);
695 DBPRINTF ("addr=%p, *addr=[%lx %lx %lx]", rp->kp.addr, (unsigned long) (*(rp->kp.addr)), (unsigned long) (*(rp->kp.addr + 1)), (unsigned long) (*(rp->kp.addr + 2)));
697 /* Establish function entry probe point */
698 if ((ret = dbi_register_kprobe (&rp->kp)) != 0)
701 DBPRINTF ("addr=%p, *addr=[%lx %lx %lx]", rp->kp.addr, (unsigned long) (*(rp->kp.addr)), (unsigned long) (*(rp->kp.addr + 1)), (unsigned long) (*(rp->kp.addr + 2)));
702 if((unsigned int)rp->kp.addr == sched_addr)
708 static void unpatch_suspended_all_task_ret_addr(struct kretprobe *rp);
710 void dbi_unregister_kretprobe (struct kretprobe *rp)
713 struct kretprobe_instance *ri;
715 dbi_unregister_kprobe (&rp->kp, 0);
717 if((unsigned int)rp->kp.addr == sched_addr) {
718 unpatch_suspended_all_task_ret_addr(rp);
723 spin_lock_irqsave (&kretprobe_lock, flags);
724 while ((ri = get_used_rp_inst (rp)) != NULL)
727 hlist_del (&ri->uflist);
729 spin_unlock_irqrestore (&kretprobe_lock, flags);
733 struct kretprobe * clone_kretprobe (struct kretprobe *rp)
735 struct kprobe *old_p;
736 struct kretprobe *clone = NULL;
739 clone = kmalloc (sizeof (struct kretprobe), GFP_KERNEL);
742 DBPRINTF ("failed to alloc memory for clone probe %p!", rp->kp.addr);
745 memcpy (clone, rp, sizeof (struct kretprobe));
746 clone->kp.pre_handler = pre_handler_kretprobe;
747 clone->kp.post_handler = NULL;
748 clone->kp.fault_handler = NULL;
749 clone->kp.break_handler = NULL;
750 old_p = get_kprobe(rp->kp.addr, rp->kp.tgid);
753 ret = register_aggr_kprobe (old_p, &clone->kp);
759 atomic_inc (&kprobe_count);
766 static void inline set_task_trampoline(struct task_struct *p, struct kretprobe_instance *ri, unsigned long tramp_addr)
768 ri->ret_addr = arch_get_task_pc(p);
769 arch_set_task_pc(p, tramp_addr);
772 static void inline rm_task_trampoline(struct task_struct *p, struct kretprobe_instance *ri)
774 arch_set_task_pc(p, ri->ret_addr);
777 static struct kretprobe_instance* find_ri_pc_mod(struct task_struct *p, struct kretprobe *rp)
779 struct kretprobe_instance *ri;
780 struct hlist_node *node, *tmp;
781 struct hlist_head *head;
784 spin_lock_irqsave (&kretprobe_lock, flags);
785 head = kretprobe_inst_table_head (p);
786 hlist_for_each_entry_safe (ri, node, tmp, head, hlist) {
787 if ((ri->rp == rp) && (p == ri->task)) {
788 spin_unlock_irqrestore (&kretprobe_lock, flags);
792 spin_unlock_irqrestore (&kretprobe_lock, flags);
797 static void add_ri_pc_mod(struct task_struct *p, struct kretprobe *rp, unsigned long tramp_addr)
799 struct kretprobe_instance *ri;
802 spin_lock_irqsave(&kretprobe_lock, flags);
803 if ((ri = get_free_rp_inst(rp)) != NULL) {
808 set_task_trampoline(p, ri, tramp_addr);
811 printk("no ri for %d\n", p->pid);
814 spin_unlock_irqrestore(&kretprobe_lock, flags);
817 static void patch_suspended_task_ret_addr(struct task_struct *p, struct kretprobe *rp)
820 struct kretprobe_instance *ri = find_ri_pc_mod(p, rp);
824 if( arch_get_task_pc(p) != (unsigned long) &kretprobe_trampoline)
825 set_task_trampoline(p, ri, (unsigned long) &kretprobe_trampoline);
827 add_ri_pc_mod(p, rp, (unsigned long) &kretprobe_trampoline);
831 static void unpatch_suspended_task_ret_addr(struct task_struct *p, struct kretprobe *rp)
833 struct kretprobe_instance *ri;
835 if( arch_get_task_pc(p) == (unsigned long)&kretprobe_trampoline )
837 ri = find_ri_pc_mod(p, rp);
839 rm_task_trampoline(p, ri);
845 void patch_suspended_all_task_ret_addr(struct kretprobe *rp)
847 struct task_struct *p, *g;
851 if(current != &init_task)
852 patch_suspended_task_ret_addr(&init_task, rp);
855 do_each_thread(g, p) {
858 patch_suspended_task_ret_addr(p, rp);
859 } while_each_thread(g, p);
863 static void unpatch_suspended_all_task_ret_addr(struct kretprobe *rp)
865 struct task_struct *p, *g;
869 unpatch_suspended_task_ret_addr(&init_task, rp);
872 do_each_thread(g, p) {
873 unpatch_suspended_task_ret_addr(p, rp);
874 } while_each_thread(g, p);
878 int __init init_kprobes (void)
882 /* FIXME allocate the probe table, currently defined statically */
883 /* initialize all list heads */
884 for (i = 0; i < KPROBE_TABLE_SIZE; i++)
886 INIT_HLIST_HEAD (&kprobe_table[i]);
887 INIT_HLIST_HEAD (&kretprobe_inst_table[i]);
889 init_uprobes_insn_slots(i);
891 atomic_set (&kprobe_count, 0);
893 err = arch_init_kprobes ();
895 DBPRINTF ("init_kprobes: arch_init_kprobes - %d", err);
900 void __exit exit_kprobes (void)
902 dbi_arch_exit_kprobes ();
905 module_init (init_kprobes);
906 module_exit (exit_kprobes);
908 EXPORT_SYMBOL_GPL (dbi_register_kprobe);
909 EXPORT_SYMBOL_GPL (dbi_unregister_kprobe);
910 EXPORT_SYMBOL_GPL (dbi_register_jprobe);
911 EXPORT_SYMBOL_GPL (dbi_unregister_jprobe);
912 EXPORT_SYMBOL_GPL (dbi_jprobe_return);
913 EXPORT_SYMBOL_GPL (dbi_register_kretprobe);
914 EXPORT_SYMBOL_GPL (dbi_unregister_kretprobe);
916 MODULE_LICENSE ("Dual BSD/GPL");