]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/proc/base.c
tracehook: tracehook_tracer_task
[linux-2.6-omap-h63xx.git] / fs / proc / base.c
index a891fe4cb43bf34e0becd16e642adfc137c0d4e3..4b74dba69a6d6761aeed6595ba543fbcfc76730a 100644 (file)
@@ -69,6 +69,7 @@
 #include <linux/mount.h>
 #include <linux/security.h>
 #include <linux/ptrace.h>
+#include <linux/tracehook.h>
 #include <linux/cgroup.h>
 #include <linux/cpuset.h>
 #include <linux/audit.h>
@@ -231,10 +232,14 @@ static int check_mem_permission(struct task_struct *task)
         * If current is actively ptrace'ing, and would also be
         * permitted to freshly attach with ptrace now, permit it.
         */
-       if (task->parent == current && (task->ptrace & PT_PTRACED) &&
-           task_is_stopped_or_traced(task) &&
-           ptrace_may_access(task, PTRACE_MODE_ATTACH))
-               return 0;
+       if (task_is_stopped_or_traced(task)) {
+               int match;
+               rcu_read_lock();
+               match = (tracehook_tracer_task(task) == current);
+               rcu_read_unlock();
+               if (match && ptrace_may_access(task, PTRACE_MODE_ATTACH))
+                       return 0;
+       }
 
        /*
         * Noone else is allowed.