aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/ptrace.c')
-rw-r--r--kernel/ptrace.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 1e68e4c39e2c..937f6b5b2008 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -123,16 +123,19 @@ int __ptrace_may_access(struct task_struct *task, unsigned int mode)
123 * because setting up the necessary parent/child relationship 123 * because setting up the necessary parent/child relationship
124 * or halting the specified task is impossible. 124 * or halting the specified task is impossible.
125 */ 125 */
126 uid_t uid;
127 gid_t gid;
126 int dumpable = 0; 128 int dumpable = 0;
127 /* Don't let security modules deny introspection */ 129 /* Don't let security modules deny introspection */
128 if (task == current) 130 if (task == current)
129 return 0; 131 return 0;
130 if (((current->uid != task->euid) || 132 current_uid_gid(&uid, &gid);
131 (current->uid != task->suid) || 133 if ((uid != task->euid ||
132 (current->uid != task->uid) || 134 uid != task->suid ||
133 (current->gid != task->egid) || 135 uid != task->uid ||
134 (current->gid != task->sgid) || 136 gid != task->egid ||
135 (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE)) 137 gid != task->sgid ||
138 gid != task->gid) && !capable(CAP_SYS_PTRACE))
136 return -EPERM; 139 return -EPERM;
137 smp_rmb(); 140 smp_rmb();
138 if (task->mm) 141 if (task->mm)