From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF64AC433DF for ; Tue, 2 Jun 2020 23:33:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC90020738 for ; Tue, 2 Jun 2020 23:33:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728445AbgFBXd7 (ORCPT ); Tue, 2 Jun 2020 19:33:59 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:54611 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726223AbgFBXd6 (ORCPT ); Tue, 2 Jun 2020 19:33:58 -0400 Received: from ip5f5af183.dynamic.kabel-deutschland.de ([95.90.241.131] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jgGPs-0001xM-5J; Tue, 02 Jun 2020 23:33:56 +0000 Date: Wed, 3 Jun 2020 01:33:55 +0200 From: Christian Brauner To: Linus Torvalds 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" Subject: Re: [PATCH v5 0/3] close_range() Message-ID: <20200602233355.zdwcfow3ff4o2dol@wittgenstein> References: <20200602204219.186620-1-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 02, 2020 at 02:03:09PM -0700, Linus Torvalds wrote: > 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. I spent some good time digging and I couldn't find this mentioned anywhere so maybe it just never got sent to the list? It sounds pretty useful, so yeah let me add a patch for this tomorrow. Christian