[FIX] probes set, when process is not running
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Wed, 15 May 2013 13:15:21 +0000 (17:15 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Wed, 15 May 2013 13:15:21 +0000 (17:15 +0400)
driver/helper.c
driver/sspt/sspt_procs.c
driver/sspt/sspt_procs.h

index 1f8b29d..0675f58 100644 (file)
@@ -66,8 +66,12 @@ static int ret_handler_pf(struct kretprobe_instance *ri, struct pt_regs *regs)
                struct sspt_procs *procs;
                procs = sspt_procs_get_by_task_or_new(task);
                if (procs) {
-                       unsigned long page = addr & PAGE_MASK;
-                       sspt_procs_install_page(procs, page);
+                       if (procs->first_install) {
+                               unsigned long page = addr & PAGE_MASK;
+                               sspt_procs_install_page(procs, page);
+                       } else {
+                               sspt_procs_install(procs);
+                       }
                }
        }
 
index a77112f..672599f 100644 (file)
@@ -64,6 +64,7 @@ struct sspt_procs *sspt_procs_create(struct dentry* dentry, struct task_struct *
                procs->task = task;
                procs->dentry = dentry;
                procs->sm = NULL;
+               procs->first_install = 0;
                INIT_LIST_HEAD(&procs->file_list);
        }
 
@@ -222,6 +223,8 @@ void sspt_procs_install(struct sspt_procs *procs)
        struct task_struct *task = procs->task;
        struct mm_struct *mm;
 
+       procs->first_install = 1;
+
        atomic = in_atomic();
        mm_read_lock(task, mm, atomic, lock);
 
index 40aef01..eb06e08 100644 (file)
@@ -38,6 +38,7 @@ struct sspt_procs {
        struct dentry *dentry;
        struct slot_manager *sm;
        struct list_head file_list;
+       unsigned first_install:1;
 };