Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1851385ybb; Thu, 9 Apr 2020 10:09:13 -0700 (PDT) X-Google-Smtp-Source: APiQypIcCloqh0CZ88Ks1cmlUpaSPVgJ7bY9Tw6WcsV5AuSYYUFbwtwx3GUNA6pxdRPPLHWCdimG X-Received: by 2002:a37:7a46:: with SMTP id v67mr839967qkc.87.1586452153632; Thu, 09 Apr 2020 10:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586452153; cv=none; d=google.com; s=arc-20160816; b=P5D20EoTWq5gVRb5wC5AJyZ9BZ06cBCrnIYdwvhUBgC7NGGGgdXYZPjA0+t7payD+F Ey5Io58p4E6Tv5f+bwXEvd9SUqAJ8EAy6w800hwePAaWezK9enr57jZmRxH0CUgR3DMp Ch/B9OeqmaURozaCl+wQ2qQCtxxCDTr6ZJiedfmnAL+Fped//vW6SsWVOrBGL9h1cnYL M9X9pO1Vv3NpMSjJOdGzau2i3UtnJX1hrnZw0/HKDIkB9Sgky1ls1A73K0luHvnH9uV6 sVv2aUNaHKY/SE0xyp09DHjLBknPIzabeSnT6VUziCL1KovNfggJ0H9Rh4vY5llEVG1o JeAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pjLWyj2I8ZRXEcsoPUZe3EIP3uQYRCpk96HRwzVQbnk=; b=juL+cYG25dX28UMlNKMcbpiHMZ/+4/Za1wGrFLw2n8Kxw/h+Kp7C1le1lDBb3uzd1y GlI5euflHijuOFnCQuI3+D7lHM5qZ0LQe+45RuQdp+Vm0tO1XyvZjSgFcliF2nOrDD96 E7VXGNBkOKKkAfWXgxKM7HkiQ3Rer5g9pHE1OBdBtmriwub6r0rHNMdNextE97OBI0aD x1I4pAJtJrEkT7NBAp0gbBw9j+F85+pK6Y0v4qa7sEJoAQ+pzprQFqW92aR0Raf+MA9z 8+2v0t87W/ddSSKSIie3U9c/jOX/JJyqIcTMWIYURyPLmGjNNRHzAWUMvKkQ0bSnXhwp +KOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="I/lJYU7l"; 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 v18si5926455qkg.156.2020.04.09.10.08.50; Thu, 09 Apr 2020 10:09:13 -0700 (PDT) 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; dkim=pass header.i=@linux-foundation.org header.s=google header.b="I/lJYU7l"; 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 S1726765AbgDIQYp (ORCPT + 99 others); Thu, 9 Apr 2020 12:24:45 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:42284 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726621AbgDIQYp (ORCPT ); Thu, 9 Apr 2020 12:24:45 -0400 Received: by mail-lj1-f194.google.com with SMTP id q19so269710ljp.9 for ; Thu, 09 Apr 2020 09:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pjLWyj2I8ZRXEcsoPUZe3EIP3uQYRCpk96HRwzVQbnk=; b=I/lJYU7leajBNnvPyJmu6JLbCzcS4aB0IAW3HpvOjsTvVp86bGB1//YtEsGZdpJIvm ADahpdwELjtXyCLmLWFUZwXs2y++7nXzUlMnKgJDCKovBNJjakJuRTWzd/n7YSMXnSUy UVXz/A9ZRAvYV6/a4QkA3yNxMrVU5EBlrMOkM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pjLWyj2I8ZRXEcsoPUZe3EIP3uQYRCpk96HRwzVQbnk=; b=QNjfM2fD/uqXlQzgUPXbR8VOGVE5Ltt3tQgtjOLIIdUpgEl8a1VykqcWEHGIHOwZkx YttTCDJqp4LT520g1FV/klc763iXb318Y2DQuBVfNBlfzZO7HiDgD5ujg8n0B972IZwT /tfXGDRquZygMY4EZ8iD5Bv26bYSiJtvkc1NfiREZkmOutTawmtstc/ubpbikg3BywRn Jq0ph0m2YUsuH3VaT/0lpIsFOiXCSNOBE40nmZOXC+HEVjXcotKyoIDPBufqDPcmq2RX lBucP0aKCdoFcN/tM4/FTlUkirlnd/XvAI+75R4IrOgNqF4K2v6VN+raaER3uvXJsP8r btsQ== X-Gm-Message-State: AGi0PuZ0PBFmfQhtsZ31esrDNWs2VqrEbWxi5SKxS1G7iMEFALCDk/D5 zvKxHIuEqQ2xVTjNXaHcYdlMdNJL16Y= X-Received: by 2002:a2e:9959:: with SMTP id r25mr371138ljj.200.1586449481748; Thu, 09 Apr 2020 09:24:41 -0700 (PDT) Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com. [209.85.208.172]) by smtp.gmail.com with ESMTPSA id 64sm10441838lfh.32.2020.04.09.09.24.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Apr 2020 09:24:40 -0700 (PDT) Received: by mail-lj1-f172.google.com with SMTP id r7so239749ljg.13 for ; Thu, 09 Apr 2020 09:24:40 -0700 (PDT) X-Received: by 2002:a2e:870f:: with SMTP id m15mr387502lji.16.1586449480215; Thu, 09 Apr 2020 09:24:40 -0700 (PDT) MIME-Version: 1.0 References: <87blobnq02.fsf@x220.int.ebiederm.org> <87lfnda3w3.fsf@x220.int.ebiederm.org> <87blo45keg.fsf@x220.int.ebiederm.org> <87v9maxb5q.fsf@x220.int.ebiederm.org> <87y2r4so3i.fsf@x220.int.ebiederm.org> In-Reply-To: From: Linus Torvalds Date: Thu, 9 Apr 2020 09:24:23 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] Please pull proc and exec work for 5.7-rc1 To: "Eric W. Biederman" Cc: Waiman Long , Ingo Molnar , Will Deacon , Bernd Edlinger , Linux Kernel Mailing List , Alexey Gladkov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 9, 2020 at 9:15 AM Linus Torvalds wrote: > > may_ptrace_stop() is supposed to stop the blocking exactly so that it > doesn't deadlock. > > I wonder why that doesn't work.. > > [ Goes and look ] > > Oh. I see. > > That ptrace_may_stop() only ever considered core-dumping, not execve(). > > But if _that_ is the reason for the deadlock, then it's trivially fixed. So maybe may_ptrace_stop() should just do something like this (ENTIRELY UNTESTED): struct task_struct *me = current, *parent = me->parent; if (!likely(me->ptrace)) return false; /* If the parent is exiting or core-dumping, it's not listening to our signals */ if (parent->signal->flags & (SIGNAL_GROUP_EXIT | SIGNAL_GROUP_COREDUMP)) return false; /* if the parent is going through a execve(), it's not listening */ if (parent->signal->group_exit_task) return false; return true; instead of the fairly ad-hoc tests for core-dumping. The above is hand-wavy - I didn't think a lot about locking. may_ptrace_stop() is already called under the tasklist_lock, so the parent won't change, but maybe it should take the signal lock? So the above very much is *not* meant to be a "do it like this", more of a "this direction, maybe"? The existing code is definitely broken. It special-cases core-dumping probably simply because that's the only case people had realized, and not thought of the execve() thing. Linus