Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3601479ybf; Tue, 3 Mar 2020 08:53:06 -0800 (PST) X-Google-Smtp-Source: ADFU+vt9psNefCkhCtLiiJaVCnYCQihT0Utxmz7ZXxQnenHd2CA0cCajy3sSo/nsC/hLy1twLUXP X-Received: by 2002:aca:abd4:: with SMTP id u203mr2978065oie.104.1583254385939; Tue, 03 Mar 2020 08:53:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583254385; cv=none; d=google.com; s=arc-20160816; b=kZWKaKupfmTU1sFM5ntUhZ+UCHn6tID6kk5A6WR60KT0megGIDrtsRqZYTvVBCoc8u IHCPjy/8d2KLrzyowrq55gVgXoPlmy0EqEjmAToenrYmoZ/pok7K0nL3hc8tTem9ePat qPj6eyBYs4XJcpSjU4ArN6zQwGAmpbaHvXwQtWGNPmUekuCdKjp1U5fqgEorEcNdZ57/ Y2+SyBdtGvQOh7Nt242ynfyOqL3ijxZLPEwMXPNJnsmt09I7o4SIRCAbYhnxuJGsGxnD ojPOhRBu06DstvDnmGnQxj89ibqrlmzx20sWmjRLrxmuFnqzRqD0I38P01KIVLVIuzT1 +0nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=lj1eBs8oySGfC5mbISRupeFmxFfCKgFhDkIMKc/oYgQ=; b=Y9Hwiawpra3FKiMuVhFT7afJCvBkK+ue3Ou/C9ums+tKqSACW0UxDLCzW5rPiMhnbH AednC9949Qjx+YW04ipwmm0+1qLXYf0j7JGbDFFTUrCeF7R9dEKmi7gbueQ/lRPQFTv0 zfa6UItVUX1jAXpX9EC6emkQPlupHH1ZTHkCFuPNLZi8ppyqXQnGeRuPf4bm+fSgyK2D 3dJKy0sAflSUD2t6QHFyo6p5yrlwI/5fo+yWM5tx5Fc9jQqwuzwApZ2+QjrcT3qMky/V yTNfq/1+a5pStW7HzSAhhHchKcgG1CC0JJD+iTPyvLFQUOMC85UAn9CtW0dTj8KYvVqT iD4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s11si7945814oic.57.2020.03.03.08.52.53; Tue, 03 Mar 2020 08:53:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730452AbgCCQvV (ORCPT + 99 others); Tue, 3 Mar 2020 11:51:21 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:49178 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730115AbgCCQvU (ORCPT ); Tue, 3 Mar 2020 11:51:20 -0500 Received: from ip5f5bf7ec.dynamic.kabel-deutschland.de ([95.91.247.236] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1j9Akd-0004ZP-Kd; Tue, 03 Mar 2020 16:50:35 +0000 Date: Tue, 3 Mar 2020 17:50:34 +0100 From: Christian Brauner To: "Eric W. Biederman" Cc: Bernd Edlinger , Kees Cook , Jann Horn , Jonathan Corbet , Alexander Viro , Andrew Morton , Alexey Dobriyan , Thomas Gleixner , Oleg Nesterov , Frederic Weisbecker , Andrei Vagin , Ingo Molnar , "Peter Zijlstra (Intel)" , Yuyang Du , David Hildenbrand , Sebastian Andrzej Siewior , Anshuman Khandual , David Howells , James Morris , Greg Kroah-Hartman , Shakeel Butt , Jason Gunthorpe , Christian Kellner , Andrea Arcangeli , Aleksa Sarai , "Dmitry V. Levin" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" , "stable@vger.kernel.org" , linux-api@vger.kernel.org Subject: Re: [PATCHv5] exec: Fix a deadlock in ptrace Message-ID: <20200303165034.5w76hbatbnr64pkd@wittgenstein> References: <87k142lpfz.fsf@x220.int.ebiederm.org> <875zfmloir.fsf@x220.int.ebiederm.org> <87v9nmjulm.fsf@x220.int.ebiederm.org> <202003021531.C77EF10@keescook> <20200303085802.eqn6jbhwxtmz4j2x@wittgenstein> <87v9nlii0b.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87v9nlii0b.fsf@x220.int.ebiederm.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 03, 2020 at 09:18:44AM -0600, Eric W. Biederman wrote: > Bernd Edlinger writes: > > > This fixes a deadlock in the tracer when tracing a multi-threaded > > application that calls execve while more than one thread are running. > > > > I observed that when running strace on the gcc test suite, it always > > blocks after a while, when expect calls execve, because other threads > > have to be terminated. They send ptrace events, but the strace is no > > longer able to respond, since it is blocked in vm_access. > > > > The deadlock is always happening when strace needs to access the > > tracees process mmap, while another thread in the tracee starts to > > execve a child process, but that cannot continue until the > > PTRACE_EVENT_EXIT is handled and the WIFEXITED event is received: > > A couple of things. > > Why do we think it is safe to change the behavior exposed to userspace? > Not the deadlock but all of the times the current code would not > deadlock? > > Especially given that this is a small window it might be hard for people > to track down and report so we need a strong argument that this won't > break existing userspace before we just change things. > > Usually surveying all of the users of a system call that we can find > and checking to see if they might be affected by the change in behavior > is difficult enough that we usually opt for not being lazy and > preserving the behavior. > > This patch is up to two changes in behavior now, that could potentially > affect a whole array of programs. Adding linux-api so that this change > in behavior can be documented if/when this change goes through. > > If you can split the documentation and test fixes out into separate > patches that would help reviewing this code, or please make it explicit > that the your are changing documentation about behavior that is changing > with this patch. Agreed. I think it'd be good to do it in three patches: 1. unrelated documentation update 2. fix + documentation changes specific to the fix 3. test(s) Christian