Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754415Ab3HERwv (ORCPT ); Mon, 5 Aug 2013 13:52:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43138 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754215Ab3HERwh (ORCPT ); Mon, 5 Aug 2013 13:52:37 -0400 Date: Mon, 5 Aug 2013 19:47:12 +0200 From: Oleg Nesterov To: Linus Torvalds Cc: Felipe Contreras , Linux Kernel Mailing List Subject: Re: Linux 3.11-rc4 Message-ID: <20130805174712.GA8461@redhat.com> References: <20130805132948.GA14942@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Content-Length: 1401 Lines: 37 On 08/05, Linus Torvalds wrote: > > On Mon, Aug 5, 2013 at 6:29 AM, Oleg Nesterov wrote: > > > > I never used wine, but I am puzzled anyway. This patch really looks > > like a simple and minor bugfix. > > The patch is indeed trivial, but.. What's the locking here? > > Afaik, ptrace_detach() by the parent can race with do_exit() by the > child, and they now _both_ do flush_ptrace_hw_breakpoint(). That would be bad. And that is why exit_ptrace() doesn't do this. But we rely on ptrace_freeze_traced(). If the child can exit (or even run), we have other problems which were hopefully fixed by 9899d11f "ensure arch_ptrace/ptrace_request can never race with SIGKILL" > We have that whole "get tasklist_lock for writing and then > check child->ptrace" logic there exactly due to that race, no? Exactly. But note that this code is very old. We can remove the "This child can be already killed" logic, and we can do more simplifications in ptrace paths. In fact, some recent changes already rely on the fact the tracee can't go away, say ptrace_peek_siginfo()->spin_lock_irq(siglock) is not safe without ptrace_freeze_traced(). Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/