Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1350243ybz; Wed, 29 Apr 2020 20:28:18 -0700 (PDT) X-Google-Smtp-Source: APiQypJzvHZyVLCwIMESddfvl6DjO8BHVbvr2LJCkhl+1saOQc7Cpj9H4uxVjSqtvGQx9A6jFCN4 X-Received: by 2002:a17:907:a89:: with SMTP id by9mr766033ejc.289.1588217298102; Wed, 29 Apr 2020 20:28:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588217298; cv=none; d=google.com; s=arc-20160816; b=D/UNsOAXb2NUNX+TpkGE8WOOMERGlOIl/uxmGwtBHJZqt6fGhMRmJK4AIFTTonKafU qpd8k/uU392WrhOXZYYzmv06HvywMOI4Ft6qh6f2IHDvoK2vjgPrUQacR8jqZGb2b/7f UPVob/FLMc752Ea3d677x7Z1mntalFxd9rHmislkfNwoows2as4KOBd/PZ6yrJnmCoMk v8yM7LIWEkCodLVli+zxg4vfOQp7TveDg1Uc6KMLJARRZce67g1d8a7HEomJjbtCdzdr fg3lMtzldMS9WGRiktVix0/5MUpghq32S7NaRRnmI1RCUW4aF6kCyGDDiCSdnORJ4UQV XjZw== 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=rep5Pfyn5wwxEy4YRJRyifa2EtharymFjZwIOhhAhjI=; b=zUyn9SZ8klmjnGjer3Um79MGP/6cPt+ZoVp4GJxTgJcYRYOD6rRXmFdiJ0g+DWQ9UO lRn9LBJk4ANuEnKxa/csG98HgOsBYAE9N6a8S5HOXdYrkB6F+LXNptJPU3MuxKRCI/AO WjxOlFNz7hwe3x1R+V8tgPh5tIevMMUepi6zTPB6tslw52aLiA7vsW19IYBnX+xrvywj wG2cT+a1Cjw42LJ/nNOov3Q9UJcKauX9xAaUvSd6DrxojZqFcBMsNsKsHIxsBZEsbGzM Rwqq59/rfZ6vt6knxo+vlHxtdwVFAGzovobv9E5LXpNTbnnIJOICAdcJCp40q0fAoc3D +G5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="hxPz/T6g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x21si5039119ejs.38.2020.04.29.20.27.55; Wed, 29 Apr 2020 20:28:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="hxPz/T6g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726501AbgD3D0G (ORCPT + 99 others); Wed, 29 Apr 2020 23:26:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726396AbgD3D0F (ORCPT ); Wed, 29 Apr 2020 23:26:05 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67F46C035494 for ; Wed, 29 Apr 2020 20:26:05 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id 188so3483574lfa.10 for ; Wed, 29 Apr 2020 20:26:05 -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=rep5Pfyn5wwxEy4YRJRyifa2EtharymFjZwIOhhAhjI=; b=hxPz/T6gnizicMHSps1pqHyi5LPdmmZAEZZ6ZvmYNNumXDosb4mxFs185exk2bmlag MzcTztnXTDRN0IqPCvpeFPqLrBVxtw2iaUxPXXHLeyci2LAR7IKzylYEMDPIi/x5ZIy+ Ni65GjbEcyASwyPX8s3S6S7ZKWXPtR2caNdDo= 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=rep5Pfyn5wwxEy4YRJRyifa2EtharymFjZwIOhhAhjI=; b=NJmUqqi2dfrVtE5Hlh2+hcehHeaHz+602o+RZDAqyqTj0h7h03hLjA3rAKMwcQegjV g/6HC+l/mijrswRDeiLaT2T2xm375ocuow51rUPKQI3Y66IvMMV0NbHzzO1UJ86XOWh5 A39X44P/jdouJtcPyPetRZfcETTqhikvtqwdgWFGFAiPqAWbb0h3IbU7zyApXxI6ekJa TF8871vxKaGC9DrCvM6X+U9TSarNSJurp0CKr215+0RGNQPnMm9Z8NztEUPlQn48y7hJ NTxJ+4rzHISjYG/PvKxrX5i7/EJxzpRutI0gRL8821NV7sWOYDuNvbTgN0DjY0ZxHbZ6 c1gA== X-Gm-Message-State: AGi0PuZREzYru2aJzjrYk8mHj07ixj0oW3q0otUQdFGOIQ0jXTxnFnmD NbwmiJeKPVkJOE0W1vT1bqEMD70XSJs= X-Received: by 2002:a05:6512:695:: with SMTP id t21mr653024lfe.158.1588217163039; Wed, 29 Apr 2020 20:26:03 -0700 (PDT) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com. [209.85.208.180]) by smtp.gmail.com with ESMTPSA id u3sm4021639lff.26.2020.04.29.20.26.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Apr 2020 20:26:01 -0700 (PDT) Received: by mail-lj1-f180.google.com with SMTP id j3so4868341ljg.8 for ; Wed, 29 Apr 2020 20:26:01 -0700 (PDT) X-Received: by 2002:a2e:8512:: with SMTP id j18mr791220lji.201.1588217161107; Wed, 29 Apr 2020 20:26:01 -0700 (PDT) MIME-Version: 1.0 References: <20200428190836.GC29960@redhat.com> In-Reply-To: From: Linus Torvalds Date: Wed, 29 Apr 2020 20:25:45 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] Please pull proc and exec work for 5.7-rc1 To: Jann Horn Cc: Bernd Edlinger , Oleg Nesterov , "Eric W. Biederman" , Waiman Long , Ingo Molnar , Will Deacon , 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 Wed, Apr 29, 2020 at 8:00 PM Jann Horn wrote: > > But if we go with Bernd's approach together with your restart > suggestion, So repeat after me: Bernd's approach _without_ the restart is unacceptable. It's unacceptable because it breaks things that currently work, and returns EAGAIN in situations where that is simple not a valid error code. His original patch also happens to be unacceptable because it's an unmaintainable mess, but that's independent of the bug it introduced. That bug has nothing to do with ptrace(). It's literally a "write()" to a file in /proc. What is so hard to get about this basic thing? > then simply doing PTRACE_ATTACH on two threads A and B > would be enough to livelock, right? The same case that just causes a recursive wait. Yes. No worse off than we were. And the fact is, *THAT* case looks truly trivial to work around. Just make the ptrace() code - but not the fs/proc/base.c code - do something like if (lock_exec_creds(tsk)) return -EINTR; and now ptrace() doesn't repeat (simply because it doesn't return that ERESTARTNOINTR. It would go through that "return through signal handling code" in the kernel, but it wouldn't actually retry the system call). But I'm getting less and less interested in trying to "fix" this problem, when people don't seem to realize that the important case is to not break _good_ programs, and the pointless buggy garbage test-case is entirely uninteresting. It's buggy user code. If it causes a wait or a livelock, nobody sane should care in the least. Fix the bug in user space. Introducing new bugs in the kernel where they didn't exist before - in order to try to work around buggy user-space that has never ever worked - is not acceptable. Linus