From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934841AbbKSSrH (ORCPT ); Thu, 19 Nov 2015 13:47:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53028 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934030AbbKSSrF (ORCPT ); Thu, 19 Nov 2015 13:47:05 -0500 Date: Thu, 19 Nov 2015 19:47:52 +0100 From: Oleg Nesterov To: Andrew Morton , Andrey Ryabinin Cc: Roland McGrath , Tejun Heo , LKML , Pedro Alves , Jan Kratochvil Subject: [PATCH 2/2] ptrace: task_stopped_code(ptrace => true) can't see TASK_STOPPED task Message-ID: <20151119184752.GC19061@redhat.com> References: <5640B7F2.70406@virtuozzo.com> <20151119184709.GA19061@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151119184709.GA19061@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org task_stopped_code()->task_is_stopped_or_traced() doesn't look right, the traced task must never be TASK_STOPPED. We can not add WARN_ON(task_is_stopped(p)), but this is only because do_wait() can race with PTRACE_ATTACH from another thread. Signed-off-by: Oleg Nesterov --- kernel/exit.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/exit.c b/kernel/exit.c index c090738..fc7b4ec 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1127,7 +1127,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) static int *task_stopped_code(struct task_struct *p, bool ptrace) { if (ptrace) { - if (task_is_stopped_or_traced(p) && + if (task_is_traced(p) && !(p->jobctl & JOBCTL_LISTENING)) return &p->exit_code; } else { -- 1.5.5.1