add flag for retprobe
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 14 Dec 2012 10:29:07 +0000 (14:29 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 14 Dec 2012 10:29:07 +0000 (14:29 +0400)
driver/new_dpf.h
driver/storage.h
driver/us_proc_inst.c

index 9e0319b..5fbe3b5 100644 (file)
@@ -339,6 +339,7 @@ struct proc_probes *get_file_probes(const inst_us_proc_t *task_inst_info)
                                us_proc_ip_t *ip = &p_libs->p_ips[k];
                                unsigned long offset = ip->offset & PAGE_MASK;
                                struct page_probes *page_p_tmp, *page_p = NULL;
+                               ip->flags |= FLAG_RETPROBE;
 
                                head = &tmp_page_probes_table[hash_ptr(offset, tmp_hash_bits)];
                                hlist_for_each_entry(page_p_tmp, node, head, hlist) {
index 279e371..2eaa852 100644 (file)
@@ -150,6 +150,10 @@ extern int event_mask;
 // process pid to instrument
 extern unsigned int inst_pid;
 
+enum FLAG_PROBE {
+       FLAG_RETPROBE = (1 << 0)
+};
+
 typedef struct
 {
        struct list_head list;
@@ -158,6 +162,8 @@ typedef struct
        struct jprobe jprobe;
        struct kretprobe retprobe;
        unsigned long offset;
+
+       enum FLAG_PROBE flags;
 } us_proc_ip_t;
 
 typedef struct
index 8cdab8d..2892014 100644 (file)
@@ -1894,18 +1894,20 @@ static int register_usprobe(struct task_struct *task, us_proc_ip_t *ip, int atom
                return ret;
        }
 
-       // Mr_Nobody: comment for valencia
-       ip->retprobe.kp.tgid = task->tgid;
-       if (ip->retprobe.handler == NULL) {
-               ip->retprobe.handler = (kretprobe_handler_t)uretprobe_event_handler;
-               DPRINTF("Set default ret event handler for %x\n", ip->offset);
-       }
+       if (ip->flags & FLAG_RETPROBE) {
+               // Mr_Nobody: comment for valencia
+               ip->retprobe.kp.tgid = task->tgid;
+               if (ip->retprobe.handler == NULL) {
+                       ip->retprobe.handler = (kretprobe_handler_t)uretprobe_event_handler;
+                       DPRINTF("Set default ret event handler for %x\n", ip->offset);
+               }
 
-       ip->retprobe.priv_arg = ip;
-       ret = dbi_register_uretprobe(task, &ip->retprobe, atomic);
-       if (ret) {
-               EPRINTF ("dbi_register_uretprobe() failure %d", ret);
-               return ret;
+               ip->retprobe.priv_arg = ip;
+               ret = dbi_register_uretprobe(task, &ip->retprobe, atomic);
+               if (ret) {
+                       EPRINTF ("dbi_register_uretprobe() failure %d", ret);
+                       return ret;
+               }
        }
 
        ip->installed = 1;
@@ -1916,7 +1918,10 @@ static int register_usprobe(struct task_struct *task, us_proc_ip_t *ip, int atom
 static int unregister_usprobe(struct task_struct *task, us_proc_ip_t * ip, int atomic, int not_rp2)
 {
        dbi_unregister_ujprobe(task, &ip->jprobe, atomic);
-       dbi_unregister_uretprobe(task, &ip->retprobe, atomic, not_rp2);
+
+       if (ip->flags & FLAG_RETPROBE) {
+               dbi_unregister_uretprobe(task, &ip->retprobe, atomic, not_rp2);
+       }
 
        ip->installed = 0;