Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1582997ybg; Tue, 2 Jun 2020 14:06:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4VfLNywn/GFc+W0TqcJe6SrOPUFnXt8YfZS1+gwowWxCU+vluM5VuAiZN/k0gKVNGSqZs X-Received: by 2002:a17:906:69d1:: with SMTP id g17mr20287410ejs.521.1591131965197; Tue, 02 Jun 2020 14:06:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591131965; cv=none; d=google.com; s=arc-20160816; b=vUJIDIHW0tUW5TXnoJEEmPajoWUwX6yHvjIJsVgCsM0bpsxlJqP3wbpcQDjugHRhhp di1cpvIKtbnyHBzv+fnRqhpEzPl+IZrhirc5i2KhT8JaPGeIMWXBM2sLu1sv0QQMf6qk JRh0TdrEiJHpV56zwhecbKcU+Q9d6kTYLVNrRiL77wGXyOc+ThbO87xu5ugoBNzIR5B5 dbNgfVjzb4DteEwLuDkFbHYGzUWQ8T79ZPkYPYSwgOxWCee/p58XkQmk6l/vKzqSASlS fWjiBOpN40ERevlexrhhchN2u9s1IuKgUFObSRkgDlT4ao9GxzZ8zElnVr+Z5xbLJQp/ 8U7g== 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=0bJlmus5XHXjv1rw00vbaJw33tmb8qsAo8E9SyQVB5o=; b=Ixz4SRCcruJ+Xqd4gEFGfcURDYKQ8fNLde8zsKBWsYhm9qr8h5j6tu203ASRwOgWId Al0Iv8Yo6XT9qFrVTI7x6jzP4FsVCBqsdHmdUzp2doA9OxNSsDBJUU/3e+9Mz38jUZEE 6KsMCXwxjqjnYpPZQKyM6M9lle6LdWy7oJbUdWcEkzB/citrmnGSMM1H5RkOlKVATCpW NS9Hq9fwMbKrgauLtGP1VJQbF28szvvbdqTvoKr64UJU7EYKgadTD9PXqi6QxxEGbwNa wNhbfrRLT8QwMaFS3kg2wlC9kFagrffngkT8iDL2hGfsNU80QkfRCpFoH4f9mBlfbP/k 5Q2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=c3OO9Eib; 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 v27si31394eja.107.2020.06.02.14.05.40; Tue, 02 Jun 2020 14:06:05 -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=c3OO9Eib; 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 S1728012AbgFBVD3 (ORCPT + 99 others); Tue, 2 Jun 2020 17:03:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbgFBVD3 (ORCPT ); Tue, 2 Jun 2020 17:03:29 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA94FC08C5C0 for ; Tue, 2 Jun 2020 14:03:28 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id u10so13121185ljj.9 for ; Tue, 02 Jun 2020 14:03:28 -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=0bJlmus5XHXjv1rw00vbaJw33tmb8qsAo8E9SyQVB5o=; b=c3OO9Eib+9QFWyiyGkaP3OWFMYITgu0SqFYiihv1nDFfvPl5LG+QGROmQ0W2vvF9TH xFPPXbu1d1Ijk8yKx1L8kgzVX4/QMqVlDd/+mMyGn+W6nAmAlpRGjtWXYEvN82lx37MV fur6Zc96Tv4VAr6lx2n2EUxpsK34AWMPsgGCg= 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=0bJlmus5XHXjv1rw00vbaJw33tmb8qsAo8E9SyQVB5o=; b=Cm+9C3Zm0w8m9uyUCukUJBq2OoeWmRw0LGtN77XQQDf/2hYuE/y97TZ2NADFG8mYl5 YM4E+KDluzLxhprfZwlYQ63HS3tDm0p2FAn37eZS7pe+8FUev928AwuJdzo+/GP5X0h4 NEKPRR8wCmG8OlvCNrcU5b6O6ydU1tZfr2vX/QgcVnBn/KKkABIB66q9N/DCe9s8o5TR 5NZmBQ6BcDRLpxZdgF0WbDtpjP7Gi+2TQcPu1YgRDngej2jjRcChq430VRmQ5tnLGYLD YIXEAByY+i/2VH+ZLTe+Ogs7u/sqbYmvAz3dnqLGH9L4tqsvXfOSIRJ8LSZFqqTcMvXZ cCHg== X-Gm-Message-State: AOAM530tVubm1FNGKF8qjusAaxO0hE24xes2R2N5cWsH2moxUHUHFt76 juqNx5HPm3i32+2Q835P46z35eRAbEs= X-Received: by 2002:a2e:88d5:: with SMTP id a21mr429346ljk.31.1591131806748; Tue, 02 Jun 2020 14:03:26 -0700 (PDT) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id s20sm46094lfb.48.2020.06.02.14.03.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Jun 2020 14:03:25 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id z18so14300110lji.12 for ; Tue, 02 Jun 2020 14:03:25 -0700 (PDT) X-Received: by 2002:a2e:7e0a:: with SMTP id z10mr460164ljc.314.1591131805045; Tue, 02 Jun 2020 14:03:25 -0700 (PDT) MIME-Version: 1.0 References: <20200602204219.186620-1-christian.brauner@ubuntu.com> In-Reply-To: <20200602204219.186620-1-christian.brauner@ubuntu.com> From: Linus Torvalds Date: Tue, 2 Jun 2020 14:03:09 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 0/3] close_range() To: Christian Brauner Cc: Linux Kernel Mailing List , Kyle Evans , Victor Stinner , Al Viro , linux-fsdevel , Linux API , Florian Weimer , Jann Horn , Oleg Nesterov , Arnd Bergmann , Shuah Khan , David Howells , "Dmitry V. Levin" 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 Tue, Jun 2, 2020 at 1:42 PM Christian Brauner wrote: > > This is a resend of the close_range() syscall, as discussed in [1]. There weren't any outstanding > discussions anymore and this was in mergeable shape. I simply hadn't gotten around to moving this > into my for-next the last few cycles and then forgot about it. Thanks to Kyle and the Python people, > and others for consistenly reminding me before every merge window and mea culpa for not moving on > this sooner. I plan on moving this into for-next after v5.8-rc1 has been released and targeting the > v5.9 merge window. Btw, I did have one reaction that I can't find in the original thread, which probably means that it got lost. If one of the designed uses for this is for dropping file descriptors just before execve(), it's possible that we'd want to have the option to say "unshare my fd array" as part of close_range(). Yes, yes, you can do unshare(CLONE_FILES); close_range(3,~0u); to do it as two operations (and you had that as the example typical use), but it would actually be better to be able to do close_range(3, ~0ul, CLOSE_RANGE_UNSHARE); instead. Because otherwise we just waste time copying the file descriptors first in the unshare, and then closing them after.. Double the work.. And maybe this _did_ get mentioned last time, and I just don't find it. I also don't see anything like that in the patches, although the flags argument is there. Linus