[PATCH 10/26] ptrace: Simplify ptrace_detach & exit_ptrace

From: Eric W. Biederman
Date: Tue Jun 06 2017 - 15:12:41 EST


Call __ptrace_unlink not __ptrace_detach. As it is guaranteed that
ptrace_detach will never be called on a process that has or may exit.

Rename __ptrace_detach __exit_ptrace as exit_ptrace is now it's only
caller and the corrected name is less confusing.

Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
---
kernel/ptrace.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 266ddcc1d8bb..490333db9e21 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -495,7 +495,7 @@ static int ignoring_children(struct sighand_struct *sigh)
* reap it now, in that case we must also wake up sub-threads sleeping in
* do_wait().
*/
-static bool __ptrace_detach(struct task_struct *tracer, struct task_struct *p)
+static bool __exit_ptrace(struct task_struct *tracer, struct task_struct *p)
{
bool dead;

@@ -539,7 +539,7 @@ static int ptrace_detach(struct task_struct *child, unsigned int data)
* the comment in ptrace_resume().
*/
child->exit_code = data;
- __ptrace_detach(current, child);
+ __ptrace_unlink(child);
write_unlock_irq(&tasklist_lock);

proc_ptrace_connector(child, PTRACE_DETACH);
@@ -559,7 +559,7 @@ void exit_ptrace(struct task_struct *tracer, struct list_head *dead)
if (unlikely(p->ptrace & PT_EXITKILL))
send_sig_info(SIGKILL, SEND_SIG_FORCED, p);

- if (__ptrace_detach(tracer, p))
+ if (__exit_ptrace(tracer, p))
list_add(&p->ptrace_entry, dead);
}
}
--
2.10.1