Skip to content

exit: Making task exiting a first class concept

Eric W. Biederman linux-api linux-arch linux-m68k lkml virtualization 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest17 patches 16 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17exit: Remove profile_task_exit & profile_munmapinclude/linux/profile.h kernel/exit.c kernel/profile.c +1 more+0 -783 replies
2/17exit: Coredumps reach do_group_exitkernel/exit.c+0 -20 replies
3/17exit: Fix the exit_code for wait_task_zombiekernel/exit.c+2 -10 replies
4/17exit: Use the correct exit_code in /proc/<pid>/statfs/proc/array.c+5 -10 replies
5/17taskstats: Cleanup the use of task->exit_codekernel/tsacct.c+3 -40 replies
6/17ptrace: Remove second setting of PT_SEIZED in ptrace_attachkernel/ptrace.c+0 -20 replies
7/17ptrace: Remove unused regs argument from ptrace_report_syscallinclude/linux/tracehook.h+3 -40 replies
8/17ptrace/m68k: Stop open coding ptrace_report_syscallarch/m68k/kernel/ptrace.c+1 -1113 replies
9/17ptrace: Move setting/clearing ptrace_message into ptrace_stopinclude/linux/ptrace.h include/linux/tracehook.h kernel/signal.c+15 -150 replies
10/17ptrace: Return the signal to continue with from ptrace_stopinclude/linux/ptrace.h include/linux/tracehook.h kernel/signal.c+24 -190 replies
11/17ptrace: Separate task->ptrace_code out from task->exit_codefs/proc/array.c include/linux/sched.h kernel/exit.c +2 more+20 -160 replies
12/17signal: Compute the process exit_code in get_signalkernel/signal.c+12 -50 replies
13/17signal: Make individual tasks exiting a first class conceptfs/coredump.c include/linux/sched/signal.h kernel/signal.c+25 -200 replies
14/17signal: Remove zap_other_threadsfs/exec.c include/linux/sched/signal.h kernel/exit.c +1 more+17 -220 replies
15/17signal: Add JOBCTL_WILL_EXIT to mark exiting tasksfs/coredump.c include/linux/sched/jobctl.h include/linux/sched/signal.h +2 more+18 -150 replies
16/17signal: Record the exit_code when an exit is scheduledfs/coredump.c fs/exec.c include/linux/sched/signal.h +2 more+15 -100 replies
17/17signal: Always set SIGNAL_GROUP_EXIT on process exitfs/coredump.c include/linux/sched/signal.h kernel/exit.c +2 more+11 -140 replies

Reviews trailers per patch

2 of 17 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchChristoph HellwigGeert UytterhoevenKees CookOleg Nesterov
SeriesR-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b R-b A-b A-b
1/17R-b
2/17
3/17
4/17
5/17
6/17
7/17
8/17A-b
9/17
10/17
11/17
12/17
13/17
14/17
15/17
16/17
17/17

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH 00/17] exit: Making task exiting a first class concept

The changes below contain some cleanups and the work to make implement first class asynchronous task exit. Most of the cleanups are necessary for this work but a couple of them (removing profile_task_exit and the extra setting of PT_SEIZED in ptrace_attach) are included because I stumbled over them and they are worth applying but they aren't interesting enough to me to make be in their own patchset.

The core of this set of changes is the addition of schedule_task_exit_locked. Ptrace is cleaned up to avoid a conflict in task->exit_code. Then the existing task exit code is gradually moved into the final shape of schedule_task_exit_locked.

This is the fundamental building block I need to fix alpha, m68k, nios2 and any other architecture that does not always save all of their registers except when entering into a ptrace context.

This is about half the work to allow coredump signals to use short-circuit delivery.

With coredumps signals available for short-circuit delivery the SA_IMMUTABLE hack can be replace by something clean.

The counting of the number of threads that have not been killed to always set SIGNAL_GROUP_EXIT when a process exits and the coredump signal short-circuit delivery is a foundation for updating the SECCOMP_RET_KILL_THREAD implementation such that it can decide if it should coredump without races.

I have most of those changes pretty much ready I just need to get these changes finalized reviewed first. At this point they are looking at v5.18 material.

These patches are on top of:
https://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git/ signal-for-v5.17

After these patches have been reviewed it is my plan to apply them to my signal-for-v5.17 branch. Any and all feedback is welcome.

Eric W. Biederman (17):
exit: Remove profile_task_exit & profile_munmap
exit: Coredumps reach do_group_exit
exit: Fix the exit_code for wait_task_zombie
exit: Use the correct exit_code in /proc/<pid>/stat
taskstats: Cleanup the use of task->exit_code
ptrace: Remove second setting of PT_SEIZED in ptrace_attach
ptrace: Remove unused regs argument from ptrace_report_syscall ptrace/m68k: Stop open coding ptrace_report_syscall
ptrace: Move setting/clearing ptrace_message into prace_stop
ptrace: Return the signal to continue with from ptrace_stop
ptrace: Separate task->ptrace_code out from task->exit_code
signal: Compute the process exit_code in get_signal
signal: Make individual tasks exiting a first class concept
signal: Remove zap_other_threads
signal: Add JOBCTL_WILL_EXIT to mark exiting tasks
signal: Record the exit_code when an exit is scheduled
signal: Always set SIGNAL_GROUP_EXIT on process exit

 arch/m68k/kernel/ptrace.c    |  12 +----
 fs/coredump.c                |  17 +++---
 fs/exec.c                    |  12 +++--
 fs/proc/array.c              |   9 +++-
 include/linux/profile.h      |  26 ---------
 include/linux/ptrace.h       |   5 +-
 include/linux/sched.h        |   1 +
 include/linux/sched/jobctl.h |   2 +
 include/linux/sched/signal.h |   6 ++-
 include/linux/tracehook.h    |  21 ++++----
 kernel/exit.c                |  29 +++++-----
 kernel/fork.c                |   2 +
 kernel/profile.c             |  50 ------------------
 kernel/ptrace.c              |  14 +++--
 kernel/signal.c              | 122 +++++++++++++++++++++++--------------------
 kernel/tsacct.c              |   7 ++-
 mm/mmap.c                    |   1 -
 17 files changed, 134 insertions(+), 202 deletions(-)