From 752dc9707567f39ed7850e21796cf2b467d71ad5 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Sat, 8 Jan 2022 09:44:58 -0600 Subject: [PATCH] signal: During coredumps set SIGNAL_GROUP_EXIT in zap_process There are only a few places that test SIGNAL_GROUP_EXIT and are not also already testing SIGNAL_GROUP_COREDUMP. This will not affect the callers of signal_group_exit as zap_process also sets group_exit_task so signal_group_exit will continue to return true at the same times. This does not affect wait_task_zombie as the none of the threads wind up in EXIT_ZOMBIE state during a coredump. This does not affect oom_kill.c:__task_will_free_mem as sig->core_state is tested and handled before SIGNAL_GROUP_EXIT is tested for. This does not affect complete_signal as signal->core_state is tested for to ensure the coredump case is handled appropriately. Link: https://lkml.kernel.org/r/20211213225350.27481-4-ebiederm@xmission.com Signed-off-by: "Eric W. Biederman" --- fs/coredump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/coredump.c b/fs/coredump.c index a6b3c196cdef..0864941a879b 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -347,13 +347,13 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm, return ispipe; } -static int zap_process(struct task_struct *start, int exit_code, int flags) +static int zap_process(struct task_struct *start, int exit_code) { struct task_struct *t; int nr = 0; /* ignore all signals except SIGKILL, see prepare_signal() */ - start->signal->flags = SIGNAL_GROUP_COREDUMP | flags; + start->signal->flags = SIGNAL_GROUP_EXIT | SIGNAL_GROUP_COREDUMP; start->signal->group_exit_code = exit_code; start->signal->group_stop_count = 0; @@ -378,7 +378,7 @@ static int zap_threads(struct task_struct *tsk, if (!signal_group_exit(tsk->signal)) { tsk->signal->core_state = core_state; tsk->signal->group_exit_task = tsk; - nr = zap_process(tsk, exit_code, 0); + nr = zap_process(tsk, exit_code); clear_tsk_thread_flag(tsk, TIF_SIGPENDING); tsk->flags |= PF_DUMPCORE; atomic_set(&core_state->nr_threads, nr);