ptrace_detach_task()->valid_signal() looks confusing. Check sig >= 0 instead and add the comment.
--- kernel/ptrace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- PU/kernel/ptrace.c~121_COMMENT_VOLUNTARY 2009-10-26 03:05:58.000000000 +0100 +++ PU/kernel/ptrace.c 2009-10-26 03:18:12.000000000 +0100 @@ -243,9 +243,13 @@ static void ptrace_wake_up(struct task_s static void ptrace_detach_task(struct task_struct *tracee, int sig) { - bool voluntary = valid_signal(sig); - enum utrace_resume_action action = UTRACE_DETACH; + /* + * If true, the caller is PTRACE_DETACH, otherwise + * the tracer detaches implicitly during exit. + */ + bool voluntary = (sig >= 0); struct utrace_engine *engine = ptrace_lookup_engine(tracee); + enum utrace_resume_action action = UTRACE_DETACH; if (unlikely(IS_ERR(engine))) return;