Fixed libonly instrumentation (#264)
authorDmitry Kovalenko <d.kovalenko@samsung.com>
Thu, 5 Jul 2012 11:55:57 +0000 (15:55 +0400)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Thu, 5 Jul 2012 11:55:57 +0000 (15:55 +0400)
driver/probes_manager.c
driver/us_proc_inst.c

index cf614cb..6173459 100644 (file)
@@ -415,11 +415,12 @@ def_jprobe_event_handler (unsigned long arg1, unsigned long arg2, unsigned long
        {
                if (us_proc_probes & US_PROC_EXEC_INSTLD)
                        /*
-                        * FIXME: This is not a good choice to call do_exit_probe_pre_code()
-                        * here.  The function should have more common name explaining that
-                        * we deinstall all the user space instrumentation from this task.
+                        * FIXME: This is not a good choice to call
+                        * do_fork_probe_pre_code() here.  The function should
+                        * have more common name explaining that we deinstall
+                        * all the user space instrumentation from this task.
                         */
-                       do_exit_probe_pre_code ();
+                       do_fork_probe_pre_code();
                if (!(probes_flags & PROBE_FLAG_EXEC_INSTLD))
                        skip = 1;
        }
index 28a6dd5..77941d1 100644 (file)
@@ -1344,6 +1344,14 @@ void do_page_fault_ret_pre_code (void)
        if (!us_proc_info.path)
                return;
 
+       if (task->flags & PF_FORKNOEXEC)
+               /*
+                * TODO:
+                * Call something like do_page_fault_ret_pre_code after exec
+                */
+               DPRINTF("ignored probe insertion during exec\n");
+               return;
+
        if (task->flags & PF_KTHREAD) {
                DPRINTF("ignored kernel thread %d\n", task->pid);
                return;
@@ -1497,15 +1505,16 @@ void do_fork_probe_pre_code(void)
        }
 
        if (!strcmp(us_proc_info.path,"*")) {
-               task_inst_info = get_task_inst_node(current);
-               if (task_inst_info)  {
-                       ret = uninstall_mapped_ips (current, task_inst_info, 1);
-                       if (ret != 0) {
-                               EPRINTF("failed to uninstall IPs (%d)!", ret);
-                       }
-                       dbi_unregister_all_uprobes(current, 1);
+               task_inst_info = get_task_inst_node(current->group_leader);
+               if (!task_inst_info) {
+                       return;
                }
-               return;
+               ret = uninstall_mapped_ips(current->group_leader,
+                                           task_inst_info, 1);
+               if (ret != 0) {
+                       EPRINTF("failed to uninstall IPs (%d)!", ret);
+               }
+               dbi_unregister_all_uprobes(current->group_leader, 1);
        } else {
                if (current->tgid != us_proc_info.tgid) {
                        return;