[IMPROVE] Web Apps: add task parent comm checking 08/24708/3
authorVasiliy Ulyanov <v.ulyanov@samsung.com>
Tue, 15 Jul 2014 09:01:57 +0000 (13:01 +0400)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Fri, 18 Jul 2014 12:40:03 +0000 (05:40 -0700)
Change-Id: Ia3c9cfc7ed50c631ee977c3ea70d2e036e41ce95
Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com>
us_manager/pf/pf_group.c
us_manager/pf/proc_filters.c

index 2d2051e..31728ca 100644 (file)
@@ -402,6 +402,10 @@ void check_task_and_install(struct task_struct *task)
        struct pf_group *pfg;
        struct sspt_proc *proc = NULL;
 
+       WARN(task != current, "Context: current(%d/%d/%s), task(%d/%d/%s)\n",
+            current->tgid, current->pid, current->comm,
+            task->tgid, task->pid, task->comm);
+
        list_for_each_entry(pfg, &pfg_list, list) {
                if (check_task_f(&pfg->filter, task) == NULL)
                        continue;
@@ -443,8 +447,7 @@ void call_page_fault(struct task_struct *task, unsigned long page_addr)
        struct sspt_proc *proc = NULL;
 
        list_for_each_entry(pfg, &pfg_list, list) {
-               if (ignore_pf(&pfg->filter) ||
-                   (check_task_f(&pfg->filter, task) == NULL))
+               if ((check_task_f(&pfg->filter, task) == NULL))
                        continue;
 
                proc = get_proc_by_pfg(pfg, task);
index 1b08d9d..842f8bc 100644 (file)
@@ -84,12 +84,17 @@ static inline void free_by_tgid(struct proc_filter *self)
 static struct task_struct *call_by_comm(struct proc_filter *self,
                                       struct task_struct *task)
 {
+       struct task_struct *parent;
        char *comm = (char *)self->data;
        size_t len = strnlen(comm, TASK_COMM_LEN);
 
        if (!strncmp(comm, task->comm, len))
                return task;
 
+       parent = task->parent;
+       if (parent && !strncmp(comm, parent->comm, len))
+               return task;
+
        return NULL;
 }