aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/ptrace.c')
-rw-r--r--kernel/ptrace.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 0692ab5a0d67..f6d8b8cb5e34 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -25,16 +25,6 @@
25 25
26 26
27/* 27/*
28 * Initialize a new task whose father had been ptraced.
29 *
30 * Called from copy_process().
31 */
32void ptrace_fork(struct task_struct *child, unsigned long clone_flags)
33{
34 arch_ptrace_fork(child, clone_flags);
35}
36
37/*
38 * ptrace a task: make the debugger its new parent and 28 * ptrace a task: make the debugger its new parent and
39 * move it to the ptrace list. 29 * move it to the ptrace list.
40 * 30 *
@@ -185,10 +175,11 @@ int ptrace_attach(struct task_struct *task)
185 if (same_thread_group(task, current)) 175 if (same_thread_group(task, current))
186 goto out; 176 goto out;
187 177
188 /* Protect exec's credential calculations against our interference; 178 /* Protect the target's credential calculations against our
189 * SUID, SGID and LSM creds get determined differently under ptrace. 179 * interference; SUID, SGID and LSM creds get determined differently
180 * under ptrace.
190 */ 181 */
191 retval = mutex_lock_interruptible(&task->cred_exec_mutex); 182 retval = mutex_lock_interruptible(&task->cred_guard_mutex);
192 if (retval < 0) 183 if (retval < 0)
193 goto out; 184 goto out;
194 185
@@ -232,7 +223,7 @@ repeat:
232bad: 223bad:
233 write_unlock_irqrestore(&tasklist_lock, flags); 224 write_unlock_irqrestore(&tasklist_lock, flags);
234 task_unlock(task); 225 task_unlock(task);
235 mutex_unlock(&task->cred_exec_mutex); 226 mutex_unlock(&task->cred_guard_mutex);
236out: 227out:
237 return retval; 228 return retval;
238} 229}
@@ -304,6 +295,8 @@ int ptrace_detach(struct task_struct *child, unsigned int data)
304 if (child->ptrace) { 295 if (child->ptrace) {
305 child->exit_code = data; 296 child->exit_code = data;
306 dead = __ptrace_detach(current, child); 297 dead = __ptrace_detach(current, child);
298 if (!child->exit_state)
299 wake_up_process(child);
307 } 300 }
308 write_unlock_irq(&tasklist_lock); 301 write_unlock_irq(&tasklist_lock);
309 302