Skip to content

kill task_detached() (Was: ptrace: kill detah tracehooks)

Oleg Nesterov lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8make do_notify_parent() return boolinclude/linux/sched.h kernel/exit.c kernel/signal.c+17 -131 reply
2/8kill tracehook_notify_death()include/linux/tracehook.h kernel/exit.c+11 -4210 replies
3/8__ptrace_detach: avoid task_detached(), check do_notify_parent()kernel/ptrace.c+18 -151 reply
4/8make do_notify_parent() __must_check, update the callersinclude/linux/sched.h kernel/exit.c+9 -221 reply
5/8reparent_leader: check EXIT_DEAD instead of task_detached()kernel/exit.c+1 -10 replies
6/8kill task_detached()include/linux/sched.h kernel/exit.c+2 -80 replies
7/8do not change dead_task->exit_signalkernel/ptrace.c kernel/signal.c+0 -20 replies
8/8redefine thread_group_leader() as exit_signal >= 0fs/exec.c include/linux/sched.h+5 -21 reply

Reviews trailers per patch

3 of 8 patches have a Reviewed-by or Acked-by.

PatchTejun Heo
1/8A-b
2/8
3/8A-b
4/8A-b
5/8
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/8] kill task_detached() (Was: ptrace: kill detah tracehooks)

Remove tracehook_notify_death(), and kill task_detached() logic.

IMHO, task_detached() is very strange and confusing. Sometimes it used instead of !thread_group_leader() when the task is live. Sometimes it is used to detect the EXIT_DEAD tasks (reparent_leader). Sometimes it used after do_notify_parent() which sets ->exit_signal = -1 to signal the caller it should set EXIT_DEAD.

Basically, this series does:

- s/task_detached/thread_group_leader/ when the caller need to know if it is the group_leader or not

- s/task_detached/EXIT_DEAD/ when the caller needs to filter out the EXIT_DEAD tasks

- changes do_notify_parent() to return a boolean and converts the callers from

do_notify_parent(p);
if (task_detached(p))
// aha, do_notify_parent() changed ->exit_signal release_task(p)

to
if (do_notify_parent(p))
release_task(p)

- kills the now unused task_detached()

- makes task->exit_signal "const" and redefines thread_group_leader() for micro-optimization.

 fs/exec.c                 |    1 +
 include/linux/sched.h     |   15 ++++-------
 include/linux/tracehook.h |   34 --------------------------
 kernel/exit.c             |   58 +++++++++++++++++++-------------------------
 kernel/ptrace.c           |   32 +++++++++++++-----------
 kernel/signal.c           |   16 ++++++------
 6 files changed, 57 insertions(+), 99 deletions(-)

Oleg.