summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--driver/sspt/sspt.h42
-rw-r--r--driver/us_proc_inst.c49
-rw-r--r--driver/us_proc_inst.h3
3 files changed, 40 insertions, 54 deletions
diff --git a/driver/sspt/sspt.h b/driver/sspt/sspt.h
index 982c6a58..cb26600a 100644
--- a/driver/sspt/sspt.h
+++ b/driver/sspt/sspt.h
@@ -97,7 +97,45 @@ enum US_FLAGS {
static inline int sspt_register_usprobe(struct us_ip *ip)
{
- return register_usprobe(ip);
+ int ret = 0;
+
+ ip->jprobe.priv_arg = ip;
+ ip->jprobe.up.task = ip->page->file->proc->task;
+ ip->jprobe.up.sm = ip->page->file->proc->sm;
+ ret = dbi_register_ujprobe(&ip->jprobe);
+ if (ret) {
+ if (ret == -ENOEXEC) {
+ pack_event_info(ERR_MSG_ID, RECORD_ENTRY, "dp",
+ 0x1,
+ ip->jprobe.up.kp.addr);
+ }
+ printk("dbi_register_ujprobe() failure %d\n", ret);
+ return ret;
+ }
+
+ if (ip->flag_retprobe) {
+ ip->retprobe.priv_arg = ip;
+ ip->retprobe.up.task = ip->page->file->proc->task;
+ ip->retprobe.up.sm = ip->page->file->proc->sm;
+ ret = dbi_register_uretprobe(&ip->retprobe);
+ if (ret) {
+ printk("dbi_register_uretprobe() failure %d\n", ret);
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+static inline int do_unregister_usprobe(struct us_ip *ip)
+{
+ dbi_unregister_ujprobe(&ip->jprobe);
+
+ if (ip->flag_retprobe) {
+ dbi_unregister_uretprobe(&ip->retprobe);
+ }
+
+ return 0;
}
static inline int sspt_unregister_usprobe(struct task_struct *task, struct us_ip *ip, enum US_FLAGS flag)
@@ -106,7 +144,7 @@ static inline int sspt_unregister_usprobe(struct task_struct *task, struct us_ip
switch (flag) {
case US_UNREGS_PROBE:
- err = unregister_usprobe(ip);
+ err = do_unregister_usprobe(ip);
break;
case US_DISARM:
disarm_uprobe(&ip->jprobe.up.kp, task);
diff --git a/driver/us_proc_inst.c b/driver/us_proc_inst.c
index 511acf67..356c79b1 100644
--- a/driver/us_proc_inst.c
+++ b/driver/us_proc_inst.c
@@ -184,52 +184,3 @@ void print_vma(struct mm_struct *mm)
}
printk("### print_vma: END\n");
}
-
-int register_usprobe(struct us_ip *ip)
-{
- int ret = 0;
-
- ip->jprobe.priv_arg = ip;
- ip->jprobe.up.task = ip->page->file->proc->task;
- ip->jprobe.up.sm = ip->page->file->proc->sm;
- ret = dbi_register_ujprobe(&ip->jprobe);
- if (ret) {
- if (ret == -ENOEXEC) {
- pack_event_info(ERR_MSG_ID, RECORD_ENTRY, "dp",
- 0x1,
- ip->jprobe.up.kp.addr);
- }
- DPRINTF ("dbi_register_ujprobe() failure %d", ret);
- return ret;
- }
-
- /* FIXME:
- * Save opcode info into retprobe, for later
- * check for instructions w\o obvious return
- */
- memcpy(&ip->retprobe.up.kp.opcode, &ip->jprobe.up.kp.opcode, sizeof(kprobe_opcode_t));
-
- if (ip->flag_retprobe) {
- ip->retprobe.priv_arg = ip;
- ip->retprobe.up.task = ip->page->file->proc->task;
- ip->retprobe.up.sm = ip->page->file->proc->sm;
- ret = dbi_register_uretprobe(&ip->retprobe);
- if (ret) {
- EPRINTF ("dbi_register_uretprobe() failure %d", ret);
- return ret;
- }
- }
-
- return 0;
-}
-
-int unregister_usprobe(struct us_ip *ip)
-{
- dbi_unregister_ujprobe(&ip->jprobe);
-
- if (ip->flag_retprobe) {
- dbi_unregister_uretprobe(&ip->retprobe);
- }
-
- return 0;
-}
diff --git a/driver/us_proc_inst.h b/driver/us_proc_inst.h
index b8675fd0..3bf2fd4e 100644
--- a/driver/us_proc_inst.h
+++ b/driver/us_proc_inst.h
@@ -42,9 +42,6 @@ enum US_FLAGS;
int is_us_instrumentation(void);
-int register_usprobe(struct us_ip *ip);
-int unregister_usprobe(struct us_ip *ip);
-
struct dentry *dentry_by_path(const char *path);
int check_vma(struct vm_area_struct *vma);