From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934859Ab3FSQgw (ORCPT ); Wed, 19 Jun 2013 12:36:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44385 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934547Ab3FSQgv (ORCPT ); Wed, 19 Jun 2013 12:36:51 -0400 Date: Wed, 19 Jun 2013 18:32:34 +0200 From: Oleg Nesterov To: Denys Vlasenko Cc: linux-kernel@vger.kernel.org, Jan Kratochvil , "Dmitry V. Levin" Subject: Re: [PATCH] ptrace: make PTRACE_DETACH work on non-stopped tracees. Message-ID: <20130619163234.GA12029@redhat.com> References: <1371654936-31742-1-git-send-email-dvlasenk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1371654936-31742-1-git-send-email-dvlasenk@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 On 06/19, Denys Vlasenko wrote: > > This is a user-visible behavior change. > Do we really have to introduce a separate > PTRACE_NOT_STUPID_DETACH? I hope not. Oh, I think yes. > @@ -1062,7 +1060,8 @@ SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr, > } > > ret = ptrace_check_attach(child, request == PTRACE_KILL || > - request == PTRACE_INTERRUPT); > + request == PTRACE_INTERRUPT || > + request == PTRACE_DETACH); There doesn't look right. For example ptrace_disable(). See the comment set_task_blockstep(). And flush_ptrace_hw_breakpoint() can race with the exiting task. And the setting of ->exit_code is racy too. And this makes the ptrace_unfreeze_traced() logic more confusing... but probably this is fine. Oleg.