1 #include <linux/module.h>
3 #include <sspt/sspt_proc.h>
4 #include <sspt/sspt_page.h>
6 #include "pf/proc_filters.h"
8 struct proc_filter *pf;
10 void (*ptr_pack_task_event_info)(struct task_struct *task,
13 const char *fmt, ...) = NULL;
15 EXPORT_SYMBOL_GPL(ptr_pack_task_event_info);
17 struct task_struct *check_task(struct task_struct *task)
22 return pf->call(pf, task);
25 int usm_register_probe(struct dentry *dentry, unsigned long offset,
26 void *pre_handler, void *jp_handler, void *rp_handler)
30 struct sspt_file *file;
33 file_name = dentry->d_iname;
34 file = sspt_proc_find_file_or_new(proc_base, dentry, file_name);
36 ip_d.flag_retprobe = 1;
38 ip_d.jp_handler = jp_handler;
40 ip_d.pre_handler = pre_handler;
41 ip_d.rp_handler = rp_handler;
43 sspt_file_add_ip(file, &ip_d);
48 EXPORT_SYMBOL_GPL(usm_register_probe);
50 int usm_unregister_probe(struct dentry *dentry, unsigned long offset)
53 struct sspt_file *file;
54 struct sspt_page *page;
57 file = sspt_proc_find_file(proc_base, dentry);
61 page = sspt_get_page(file, offset);
65 ip = sspt_find_ip(page, offset & ~PAGE_MASK);
77 EXPORT_SYMBOL_GPL(usm_unregister_probe);
81 int iRet = 0, found = 0;
82 struct task_struct *task = NULL;
83 struct sspt_proc *proc;
84 int tmp_oops_in_progress;
89 printk("uninstall_kernel_probe(do_munmap) result=%d!\n", iRet);
94 tmp_oops_in_progress = oops_in_progress;
97 for_each_process(task) {
101 proc = sspt_proc_get_by_task(task);
103 int ret = sspt_proc_uninstall(proc, task, US_UNREGS_PROBE);
105 printk("failed to uninstall IPs (%d)!\n", ret);
107 dbi_unregister_all_uprobes(task);
111 oops_in_progress = tmp_oops_in_progress;
116 sspt_proc_free_all();
120 EXPORT_SYMBOL_GPL(usm_stop);
125 struct task_struct *task = NULL, *ts;
126 struct sspt_proc *proc;
127 int tmp_oops_in_progress;
129 ret = register_helper();
137 tmp_oops_in_progress = oops_in_progress;
138 oops_in_progress = 1;
140 for_each_process(task) {
141 if (is_kthread(task))
144 ts = check_task(task);
147 proc = sspt_proc_get_by_task_or_new(ts);
148 sspt_proc_install(proc);
152 oops_in_progress = tmp_oops_in_progress;
156 EXPORT_SYMBOL_GPL(usm_start);
158 static int __init init_us_manager(void)
169 static void __exit exit_us_manager(void)
174 module_init(init_us_manager);
175 module_exit(exit_us_manager);
177 MODULE_LICENSE ("GPL");