Ptrace: enable the process to read other process's stack and comm
authorxiaobing tu <xiaobing.tu@intel.com>
Wed, 6 Jun 2012 06:42:01 +0000 (14:42 +0800)
committerbuildbot <buildbot@intel.com>
Mon, 11 Jun 2012 23:58:08 +0000 (16:58 -0700)
BZ: 36161

For debug usage,For debug ANR and UIWDT issues, we need get more details from the
/d/binder, /proc/xxx/stack, proc/xxx/comm, from it we can know which
process block the binder read, and we can also get more other useful
informations, but the current ptrace implement may block it. the patch
add a debugfs interface to enable read by default.
Signed-off-by: xiaobing tu <xiaobing.tu@intel.com>
Change-Id: Ied22eaa00316ff5e3602799af5825f2afb4fa21f
Reviewed-on: http://android.intel.com:8080/51907
Reviewed-by: Zhang, LongX <longx.zhang@intel.com>
Reviewed-by: Gross, Mark <mark.gross@intel.com>
Reviewed-by: Ren, Jack <jack.ren@intel.com>
Reviewed-by: Yang, Fei <fei.yang@intel.com>
Tested-by: Ng, Cheon-woei <cheon-woei.ng@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
kernel/ptrace.c

index 2df1157..af1a6af 100644 (file)
 #include <linux/uaccess.h>
 #include <linux/regset.h>
 #include <linux/hw_breakpoint.h>
+#include <linux/debugfs.h>
 
-
+static int ptrace_can_access;
+module_param_named(ptrace_can_access, ptrace_can_access, int, \
+       S_IRUGO | S_IWUSR | S_IWGRP);
 /*
  * ptrace a task: make the debugger its new parent and
  * move it to the ptrace list.
@@ -176,6 +179,9 @@ ok:
 bool ptrace_may_access(struct task_struct *task, unsigned int mode)
 {
        int err;
+
+       if (ptrace_can_access)
+               return true;
        task_lock(task);
        err = __ptrace_may_access(task, mode);
        task_unlock(task);