Skip to content

Commit cf43a75

Browse files
committed
signal: Restore the stop PTRACE_EVENT_EXIT
In the middle of do_exit() there is there is a call "ptrace_event(PTRACE_EVENT_EXIT, code);" That call places the process in TACKED_TRACED aka "(TASK_WAKEKILL | __TASK_TRACED)" and waits for for the debugger to release the task or SIGKILL to be delivered. Skipping past dequeue_signal when we know a fatal signal has already been delivered resulted in SIGKILL remaining pending and TIF_SIGPENDING remaining set. This in turn caused the scheduler to not sleep in PTACE_EVENT_EXIT as it figured a fatal signal was pending. This also caused ptrace_freeze_traced in ptrace_check_attach to fail because it left a per thread SIGKILL pending which is what fatal_signal_pending tests for. This difference in signal state caused strace to report strace: Exit of unknown pid NNNNN ignored Therefore update the signal handling state like dequeue_signal would when removing a per thread SIGKILL, by removing SIGKILL from the per thread signal mask and clearing TIF_SIGPENDING. Acked-by: Oleg Nesterov <oleg@redhat.com> Reported-by: Oleg Nesterov <oleg@redhat.com> Reported-by: Ivan Delalande <colona@arista.com> Cc: stable@vger.kernel.org Fixes: 35634ff ("signal: Always notice exiting tasks") Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
1 parent 7146db3 commit cf43a75

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

kernel/signal.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,9 +2436,12 @@ bool get_signal(struct ksignal *ksig)
24362436
}
24372437

24382438
/* Has this task already been marked for death? */
2439-
ksig->info.si_signo = signr = SIGKILL;
2440-
if (signal_group_exit(signal))
2439+
if (signal_group_exit(signal)) {
2440+
ksig->info.si_signo = signr = SIGKILL;
2441+
sigdelset(&current->pending.signal, SIGKILL);
2442+
recalc_sigpending();
24412443
goto fatal;
2444+
}
24422445

24432446
for (;;) {
24442447
struct k_sigaction *ka;

0 commit comments

Comments
 (0)