ptrace: don't sleep in TASK_TRACED if SIGKILL is pending
PATCH 1/1 ptrace: don't sleep in TASK_TRACED if SIGKILL is pending
ptrace_stop() has some complicated checks to prevent the scheduling in the TASK_TRACED state with the pending SIGKILL, but these checks are racy, and they depend on arch_ptrace_stop_needed().
This patch assumes that the traced task should die asap if it was killed by SIGKILL, in that case schedule()->signal_pending_state() has no reason to ignore the TASK_WAKEKILL part of TASK_TRACED, and we can kill this nasty special case.
Note: do_exit()->ptrace_notify() is special, the killed task can already dequeue SIGKILL at this point and deceive __fatal_signal_pending(), this needs further fixes.
Signed-off-by Oleg Nesterov <[email protected]>
include/linux/sched.h renamed from include/linux/sched.h~1_KILL_TRACED_CHECK +0 -3
@@ -2034,9 +2034,6 @@ static inline int signal_pending_state(lif (!signal_pending (p))return 0 ; -if (state & (__TASK_STOPPED | __TASK_TRACED)) -return 0 ; -return (state &TASK_INTERRUPTIBLE ) ||__fatal_signal_pending (p); }