Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1196593yba; Thu, 16 May 2019 16:26:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+YiR7xU4g6mgC9eKayIDywOhoi0nZDGkA1IYmLHffIpBEvTjpopjPE8cw0xezW4g5DJq0 X-Received: by 2002:a63:5964:: with SMTP id j36mr53311003pgm.384.1558049171156; Thu, 16 May 2019 16:26:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558049171; cv=none; d=google.com; s=arc-20160816; b=hIRwb8shDQ3P9+BMF82SZ2acr5HL5//QNYKsYvZqHWzGLgiw+WM45nlgk38PrfCP8G wLCectrkPnz19dnxvUuuA7PccnD89k6a6bPjvhh7H5E65vzxEFJkRp25L4Rv80E+09Gh Ik5cDg7+Udwj+sW4cl2XquDsc/asQ0zL7LMV614T/hBeCf6iRb7R8YA45i2FxXgS7/YD J+MiSglDsp7Vw3T+scuWnBblVZiVFBJml8pvZddvzoBuxHliUQ137KPdy6/N48nnK7p4 VDWc3vq457PxUUYTODLdHxL9ZdIJUgaQ9ySrpFkobRxLNd0k/BBgv0VsbwetoiqDn3J7 py9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=iOuGO8LgKUj7kMXVtrqid/EvrqCgMODIJTfZmwoFC4U=; b=Clz1YqbKW3GtqrAa3eFe+cV8XBP0uVe4/jh2Ol9irbpjfNifQ2d29msut2juf4j0uT n53J6k04xTHvChAAFrrRZM2tkPIT09OvKZeD2Madv4eURAkENfSUUkjsHu8FVCRrwg5w Oj48ET8DclOkJ8zea+wUVTtrn7QPJkfZpl/R0QFTrYWB/Ujdh2GoaGPPfwsYmmt1fDks YNHFGZJ7i6RH8vkyndrz+a6j5wYk5oGOX26LjKscViQKu044xK7lLXKD5esiv/6ggUEy S3gyG/qddO6JfIfFvOZUCLQ84Wu+iYyOIuB1MB9xD7P0ss0OKquAvo1SPAyMGMKgdlDz x8FA== ARC-Authentication-Results: i=1; mx.google.com; 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 p5si6274125pli.338.2019.05.16.16.25.56; Thu, 16 May 2019 16:26:11 -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; 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 S1727796AbfEPUXf (ORCPT + 99 others); Thu, 16 May 2019 16:23:35 -0400 Received: from vmicros1.altlinux.org ([194.107.17.57]:50168 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726409AbfEPUXf (ORCPT ); Thu, 16 May 2019 16:23:35 -0400 Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id A0DE572CCD5; Thu, 16 May 2019 23:23:31 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 8D0A47CC6FF; Thu, 16 May 2019 23:23:31 +0300 (MSK) Date: Thu, 16 May 2019 23:23:31 +0300 From: "Dmitry V. Levin" To: Al Viro Cc: Christian Brauner , David Howells , torvalds@linux-foundation.org, Arnd Bergmann , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH 0/4] uapi, vfs: Change the mount API UAPI [ver #2] Message-ID: <20190516202331.GA29908@altlinux.org> References: <155800752418.4037.9567789434648701032.stgit@warthog.procyon.org.uk> <20190516162259.GB17978@ZenIV.linux.org.uk> <20190516163151.urrmrueugockxtdy@brauner.io> <20190516165021.GD17978@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190516165021.GD17978@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [looks like linux-abi is a typo, Cc'ed linux-api instead] On Thu, May 16, 2019 at 05:50:22PM +0100, Al Viro wrote: > [linux-abi cc'd] > > On Thu, May 16, 2019 at 06:31:52PM +0200, Christian Brauner wrote: > > On Thu, May 16, 2019 at 05:22:59PM +0100, Al Viro wrote: > > > On Thu, May 16, 2019 at 12:52:04PM +0100, David Howells wrote: > > > > > > > > Hi Linus, Al, > > > > > > > > Here are some patches that make changes to the mount API UAPI and two of > > > > them really need applying, before -rc1 - if they're going to be applied at > > > > all. > > > > > > I'm fine with 2--4, but I'm not convinced that cloexec-by-default crusade > > > makes any sense. Could somebody give coherent arguments in favour of > > > abandoning the existing conventions? > > > > So as I said in the commit message. From a userspace perspective it's > > more of an issue if one accidently leaks an fd to a task during exec. > > > > Also, most of the time one does not want to inherit an fd during an > > exec. It is a hazzle to always have to specify an extra flag. > > > > As Al pointed out to me open() semantics are not going anywhere. Sure, > > no argument there at all. > > But the idea of making fds cloexec by default is only targeted at fds > > that come from separate syscalls. fsopen(), open_tree_clone(), etc. they > > all return fds independent of open() so it's really easy to have them > > cloexec by default without regressing anyone and we also remove the need > > for a bunch of separate flags for each syscall to turn them into > > cloexec-fds. I mean, those for syscalls came with 4 separate flags to be > > able to specify that the returned fd should be made cloexec. The other > > way around, cloexec by default, fcntl() to remove the cloexec bit is way > > saner imho. > > Re separate flags - it is, in principle, a valid argument. OTOH, I'm not > sure if they need to be separate - they all have the same value and > I don't see any reason for that to change... > > Only tangentially related, but I wonder if something like close_range(from, to) > would be a more useful approach... That kind of open-coded loops is not > rare in userland and kernel-side code can do them much cheaper. Something > like > /* that exec is sensitive */ > unshare(CLONE_FILES); > /* we don't want anything past stderr here */ > close_range(3, ~0U); > execve(....); > on the userland side of thing. Comments? glibc people need a syscall to implement closefrom properly, see https://sourceware.org/bugzilla/show_bug.cgi?id=10353#c14 -- ldv