Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp262528ybi; Fri, 24 May 2019 03:31:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgdDbuC4zMdmNCYL9zRi9u6UobI/h6ODqIbDgi5etTQJy9jRenoNrxLr24gSObj7KNPVkj X-Received: by 2002:a63:cc4b:: with SMTP id q11mr105128020pgi.43.1558693865097; Fri, 24 May 2019 03:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558693865; cv=none; d=google.com; s=arc-20160816; b=tOUnEUnTrAuB4y1cW/o9nALd4ph1uK2xvF9Edp34pzv50OyKFSqejzwIWuvdTrP08S WxwtguBNhcL5Ox4Xe0I4WMqUpwityqZ0OHRMCpr9QlUMzcR1lXgqM6XNK2dOXrZjxDGj HBhctL7jd5sQpcsHsXBJyy1MCNGPXjjBHJd/kYSj8es1ZhDkujQkx+ME1HNfXIhcII2/ fJBPp8AFEU0z56ouqClyvGjCYEsHH1ZxM8AwW67s8COxz6eG1pKPO8jnhg9bX3KqFU7x ltnqWVV44/73oaNOVm7wbaPiJtxL0gDRGh1TQ4l+7r92zKhzeVyiGN9rcg5MEJ6NoDMU 75qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=lQOFmVbb9NS+iTEPlWwBX0kt6HHZdRsOcnWjM/3njwc=; b=jfOQKrZMiKA3rnS2cGhYP5MnU0Uc0cKU+5vocWkWOFQL8DLzDs4UIpQH2ZvHL3HP8D wDyZCmTW+YrSJqFHHZnD9aiHB7iVXXG96dvKTP8sF3CdDVF005E1ZanvB24l/J93gCvf Yik3JSBa5carYIQZFr1OHWNN4mX7zT1nK0OUh1L3cTdOPGadu0o1oNiTShO6A29NwH6c WtN+u9lZ7yGjVlvKwEmvyiHvBkhPXhIzwMe8eatUlJwVLbyurG6ohts0FpJh0rufT1J/ GEqqzVR7P6/PMamAh+2pTra5GE91DaRKeIDEsdojNRbIuwAwKXwoT8bNiM3MHlT6KOxf HbLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b="AY0ya/6q"; 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 j23si3435003pgj.85.2019.05.24.03.30.45; Fri, 24 May 2019 03:31:05 -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=@brauner.io header.s=google header.b="AY0ya/6q"; 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 S2390374AbfEXK2F (ORCPT + 99 others); Fri, 24 May 2019 06:28:05 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:52897 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390156AbfEXK2F (ORCPT ); Fri, 24 May 2019 06:28:05 -0400 Received: by mail-it1-f193.google.com with SMTP id t184so14899325itf.2 for ; Fri, 24 May 2019 03:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=lQOFmVbb9NS+iTEPlWwBX0kt6HHZdRsOcnWjM/3njwc=; b=AY0ya/6qCoCKbbiDDvO8+/wWIH6ZztkkxdM0TElnygz8SyZWmaxI+wrxoxh3BteKH5 rHrFPHoSXiF6l8Q3mQWdcuFfb5RiQmnw/D4Y/JWCQNk2g3YCQ8a5iVIofknT9r8qPFBm RRiCr8yiYjUNzi+d7o1UyE0cXRoYx5reqlVO2qDUYosU/e+1wx2YJ1ddwDHW2tnHADAF rZbSCnA/ZRUAoQZ/CRlEl8a6IfT9BbmVCR23R9XlmNKC+Kg4WFseuJIjaV5cZv/Xs85G /wxayT1xut3WTT3270zlG0oh8wgP8pkw57Z2/hfOBiusZTlyVfyLjh4TAEVM54IEDqO3 lV5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=lQOFmVbb9NS+iTEPlWwBX0kt6HHZdRsOcnWjM/3njwc=; b=TD2Ka281NSb7WG7KbUeVf3+0ilLsuU7BBIStzOPt/X9WbLpVh4uc58OS747YGE+PNz TQNPzrVsCWqJu9/eifbEdF2trEkHnlfrIJPHaFbS0LA3jYvN4kWo/g37g0owfIL4JQ8D YYlqck+DN/JWqfwenDJ9sHxBhuW2xcPIeYp+SDUNe6TuBNiMY6/8yk/KxsUnEe8ZYEoi 4f/s++wiPSs1CF2sPt0GNAfJ8nTJVg9dOh6TxevTkrADlbcyUxdbh6T44Qyq0jqFEru8 UInX79iMJ0q3sQyrysm1nZVVU6AC/LljA0cdX07dSsnDVPLgYMun5qRj1fFebZTI1Teb jrpQ== X-Gm-Message-State: APjAAAUlpOYsl8Ena01IcvxOLBBLP3J1zECnpJ08rpI8fj/NgT+d5/bi Q7AR1Ion4YvFvIXUTtJkCazitw== X-Received: by 2002:a24:3d08:: with SMTP id n8mr17306791itn.56.1558693684484; Fri, 24 May 2019 03:28:04 -0700 (PDT) Received: from brauner.io ([172.56.12.37]) by smtp.gmail.com with ESMTPSA id g124sm1024044itg.12.2019.05.24.03.28.00 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 24 May 2019 03:28:03 -0700 (PDT) Date: Fri, 24 May 2019 12:27:58 +0200 From: Christian Brauner To: Linus Torvalds Cc: Alexey Dobriyan , fweimer@redhat.com, oleg@redhat.com, arnd@arndb.de, viro@zeniv.linux.org.uk, Linux List Kernel Mailing , linux-fsdevel Subject: Re: [PATCH v2 0/2] close_range() Message-ID: <20190524102756.qjsjxukuq2f4t6bo@brauner.io> References: <20190523182152.GA6875@avx2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 23, 2019 at 02:34:31PM -0700, Linus Torvalds wrote: > On Thu, May 23, 2019 at 11:22 AM Alexey Dobriyan wrote: > > > > > This is v2 of this patchset. > > > > We've sent fdmap(2) back in the day: > > Well, if the main point of the exercise is performance, then fdmap() > is clearly inferior. > > Sadly, with all the HW security mitigation, system calls are no longer cheap. > > Would there ever be any other reason to traverse unknown open files > than to close them? I have had lively discussions and interestingly worded mails on account of all of this. But noone has brought up this scenario. Florian also said that it's not needed [1]. If we really want something like that we don't really need a new syscall I think. We can just do a prctl() command or fcntl() command that will give you back the next open fd. There's imho crazy ideas out there what people expect a multi-close file descriptor solution to look like. Service manager people apparently think it would be a great idea to have a syscall that takes an array of fds which the kernel is supposed to leave open and close all others, basically "close all of the fds only leave out those I tell you". I think for such a use-cases they can push for a prctl(PR_GET_NEXTFD, 2) or a fcntl(2, F_GET_NEXTFD) and implement that in userspace. I really only care about having a performant solution to closing a range of fds that's a little more flexible than closefrom() without going all crazy generic and copying (possibly) large bits of data between kernel- and userspace. close_range() is really something I've picked up on the side because the current state has bothered me (and others) a long time whenever I have to have my userspace hat on. With Al being in favor of it this seemed like we should do it. I actually wanted to have Jann's and my clone6() version on the table by now since that would unblock larger things like the time namespace patchset. In any case I'll send v3 with my max()/min() braino fixed that Oleg thankfully spotted and the split into two patches that Arnd suggested. [1]: https://lkml.org/lkml/2019/5/21/516