Merge branch 'refs/heads/master' of ssh://lastakhov@106.109.8.71/srv/git/dbi_new_build
authorLeonid Astakhov <l.astakhov@samsung.com>
Wed, 27 Apr 2011 06:38:24 +0000 (10:38 +0400)
committerLeonid Astakhov <l.astakhov@samsung.com>
Wed, 27 Apr 2011 06:38:24 +0000 (10:38 +0400)
1  2 
driver/storage.c
driver/us_proc_inst.c

@@@ -1127,7 -1109,8 +1131,8 @@@ int link_bundle(
                kfree (addrs);
                kfree(s_lib.p_vtps);
        }
 -      }
 +
        /* Conds */
        /* first, delete all the conds */
        list_for_each_entry_safe(c, c_tmp, &cond_list.list, list) {
@@@ -364,64 -351,33 +363,51 @@@ static int install_mapped_ips (struct t
                 * After process was forked, some time it inherits parent process environment.
                 * We need to renew instrumentation when we detect that process gets own environment.
                 */
+               if (vma->vm_flags & VM_EXECUTABLE) {
+                   if (!task_inst_info->m_f_dentry) {
+                       task_inst_info->m_f_dentry = vma->vm_file->f_dentry;
+                       printk("initiate dentry tgid = %d\n", task->tgid, task->comm);
+                   } else if (task_inst_info->m_f_dentry != vma->vm_file->f_dentry) {
+                       printk("we have detected that detry was changed tgid = %d\n", task->tgid, task->comm);
+                       for (i = 0; i < task_inst_info->libs_count; i++) {
+                           task_inst_info->p_libs[i].loaded = 0;
+                           for (k = 0; k < task_inst_info->p_libs[i].ips_count; k++) {
+                               task_inst_info->p_libs[i].p_ips[k].installed = 0;
+                               task_inst_info->unres_ips_count++;
+                           }
  
- //        DPRINTF("vma_start:%x vma_end:%x", vma->vm_start, vma->vm_end );
-               if (vma->vm_flags & VM_EXECUTABLE)
-               {
- //                    DPRINTF("VM_EXECUTABLE");
-                   if (!task_inst_info->m_f_dentry)
-                   {
-                               task_inst_info->m_f_dentry = vma->vm_file->f_dentry;
-                               printk("initiate dentry tgid = %d\n", task->tgid, task->comm);
-                   }
-                   else if (task_inst_info->m_f_dentry != vma->vm_file->f_dentry)
-                   {
-                               printk("we have detected that detry was changed tgid = %d\n", task->tgid, task->comm);
-                               for (i = 0; i < task_inst_info->libs_count; i++)
-                               {
-                                       task_inst_info->p_libs[i].loaded = 0;
-                                       for (k = 0; k < task_inst_info->p_libs[i].ips_count; k++)
-                                       {
-                                               task_inst_info->p_libs[i].p_ips[k].installed = 0;
-                                               task_inst_info->unres_ips_count++;
-                                       }
-                                       for (k = 0; k < task_inst_info->p_libs[i].vtps_count; k++)
-                                       {
-                                               task_inst_info->p_libs[i].p_vtps[k].installed = 0;
-                                               task_inst_info->unres_vtps_count++;
-                                       }
+                           for (k = 0; k < task_inst_info->p_libs[i].vtps_count; k++) {
+                               task_inst_info->p_libs[i].p_vtps[k].installed = 0;
+                               task_inst_info->unres_vtps_count++;
+                           }
  
-                                       task_inst_info->m_f_dentry = vma->vm_file->f_dentry;
-                               }
+                           task_inst_info->m_f_dentry = vma->vm_file->f_dentry;
+                       }
                    }
                }
 +
 +//            DPRINTF("Instrumenting libs. libcount:%d", task_inst_info->libs_count );
                
 -              for (i = 0; i < task_inst_info->libs_count; i++) {      
 +              for (i = 0; i < task_inst_info->libs_count; i++)
 +              {
 +//                    struct path tmp_path;
 +//
 +//                    tmp_path.dentry = task_inst_info->p_libs[i].m_f_dentry;
 +//                    tmp_path.mnt = task_inst_info->p_libs[i].m_vfs_mount;
 +//
 +//                    char* p_path = d_path ( &tmp_path, path_buffer, 255 );
 +//
 +//                    DPRINTF("f_dentry:%x m_f_dentry:%x path:%s", vma->vm_file->f_dentry, task_inst_info->p_libs[i].m_f_dentry, p_path );
 +
                        //TODO: test - try to instrument non-existing libs
 -                      if (vma->vm_file->f_dentry == task_inst_info->p_libs[i].m_f_dentry) {
 -                              if(!(vma->vm_flags & VM_EXECUTABLE) && !task_inst_info->p_libs[i].loaded) {
 +                      if (vma->vm_file->f_dentry == task_inst_info->p_libs[i].m_f_dentry)
 +                      {
 +//                            DPRINTF("vm_flags:%x loaded:%x ips_count:%d vtps_count:%d", vma->vm_flags, task_inst_info->p_libs[i].loaded,
 +//                                            task_inst_info->p_libs[i].ips_count, task_inst_info->p_libs[i].vtps_count );
 +
 +                              if(!(vma->vm_flags & VM_EXECUTABLE) && !task_inst_info->p_libs[i].loaded)
 +                              {
 +//                                    DPRINTF("!VM_EXECUTABLE && !loaded");
                                        char *p;
                                        DPRINTF ("post dyn lib event %s/%s", current->comm, task_inst_info->p_libs[i].path);
                                        // if we installed something, post library info for those IPs
                                                        task_inst_info->unres_ips_count--;
                                                        
                                                        err = register_usprobe (task, mm, &task_inst_info->p_libs[i].p_ips[k], atomic, 0);
++<<<<<<< HEAD
 +                                                      if (err != 0)
 +                                                      {
++=======
+                                                       if (!err) {
++>>>>>>> branch 'refs/heads/master' of ssh://lastakhov@106.109.8.71/srv/git/dbi_new_build
                                                                DPRINTF ("failed to install IP at %lx/%p. Error %d!", task_inst_info->p_libs[i].p_ips[k].offset, 
-                                                                               task_inst_info->p_libs[i].p_ips[k].jprobe.kp.addr, err);
+                                                                               task_inst_info->p_libs[i].p_ips[k].jprobe.kp.addr);
                                                        }
                                                }
                                        }