Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp994562ybl; Wed, 8 Jan 2020 09:11:16 -0800 (PST) X-Google-Smtp-Source: APXvYqylf3wBASSUAY/fNrB+oZ63gtQEy0hAVAzoojkRtcOIcpX0fBx0Qaq+XmO0ZfSVl9kLhuuO X-Received: by 2002:aca:e084:: with SMTP id x126mr3756205oig.97.1578503476702; Wed, 08 Jan 2020 09:11:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578503476; cv=none; d=google.com; s=arc-20160816; b=fZ5D9a/45H6PmBqZLqDu2RrhL5v4Zwm0nV/V8UQQ/SOnp2cHl/x8kTPaRA6hdPxWvE yPZW8mYhH1Cls8t3S7WqFs7mimr73HBGPP+pIs05nl2R9yaYNvY0Xq+DnL42IxC8elCz MNyJsov12wjQJWGEXAe8iPEiDYIovbf1fx4GQH4TzutOkPTSn2thMv/ZrT0nBKQ0g57E u6obPLmU/9/QsrvXP8RhDcmHcJbUmCCstEaZLS+2F/gaf8+qoH/KseazJW61BBcxL4vH z7h7JNOeN7MX54z+9cUodby9RPkEvLUqwaIRWilaO31eIzpJRMD3LAlMUyt53dhYXbhf +RfQ== 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; bh=3C1EnsHhE0gstFUbF+yJwbXQ7GR6/rfioFUkRhQKDmU=; b=SVmM6jwQ0w4IFXAGS+X/vWx0V3Tq3z5XoC1CeRCUJMO+HjpiSgpD4r9WS3+jU36fzA b+CbLoZSO7Eku5QfUMT/7Hf46az2iIHAPP4D90xNI192iUuVK5bgqy1mk/UV8jsIqGb8 ajSZ4r7QoJYMQt82BDGepTr3fxkeop3izh2zvy4aRnPVGjp/WLSSYn2x+Mxx6DVjI8EI CyGozSub1xIAoc42tPXlZqEeATAMcFO23GBNVFL0CeTkLxd8gZH/B4PahvTyvC+3tiEp wDJsuCgQx3dH3noizgm5MJdqVE69L06BrChM1Cuob9eMQp2yAfCc7ZO02u0q4wHK0jrG XYsA== 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 d6si1983493otq.41.2020.01.08.09.10.56; Wed, 08 Jan 2020 09:11:16 -0800 (PST) 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 S1729670AbgAHRJV (ORCPT + 99 others); Wed, 8 Jan 2020 12:09:21 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:36501 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbgAHRJV (ORCPT ); Wed, 8 Jan 2020 12:09:21 -0500 Received: from host.242.234.23.62.rev.coltfrance.com ([62.23.234.242] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ipEnM-00052V-PD; Wed, 08 Jan 2020 17:07:00 +0000 Date: Wed, 8 Jan 2020 18:07:04 +0100 From: Christian Brauner To: James Bottomley Cc: David Howells , Al Viro , linux-fsdevel@vger.kernel.org, Christian Brauner , Miklos Szeredi , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH v2 0/6] introduce configfd as generalisation of fsconfig Message-ID: <20200108170703.zhcuohzdp22y5yma@wittgenstein> References: <20200104201432.27320-1-James.Bottomley@HansenPartnership.com> <20200105162311.sufgft6kthetsz7q@wittgenstein> <1578247328.3310.36.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1578247328.3310.36.camel@HansenPartnership.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [extending the Cc a bit] On Sun, Jan 05, 2020 at 10:02:08AM -0800, James Bottomley wrote: > On Sun, 2020-01-05 at 17:23 +0100, Christian Brauner wrote: > > On Sat, Jan 04, 2020 at 12:14:26PM -0800, James Bottomley wrote: > > > fsconfig is a very powerful configuration mechanism except that it > > > only works for filesystems with superblocks. This patch series > > > generalises the useful concept of a multiple step configurational > > > mechanism carried by a file descriptor. The object of this patch > > > series is to get bind mounts to be configurable in the same way > > > that superblock based ones are, but it should have utility beyond > > > the filesytem realm. Patch 4 also reimplements fsconfig in terms > > > of configfd, but that's not a strictly necessary patch, it is > > > merely a useful demonstration that configfd is a superset of the > > > properties of fsconfig. > > > > Thanks for the patch. I'm glad fsconfig() is picked back up; either > > by you or by David. We will need this for sure. > > But the configfd approach does not strike me as a great idea. > > Anonymous inode fds provide an abstraction mechanism for kernel > > objects which we built around fds such as timerfd, pidfd, mountfd and > > so on. When you stat an anonfd you get ANON_INODE_FS_MAGIC and you > > get the actual type by looking at fdinfo, or - more common - by > > parsing out /proc//fd/ and discovering "[fscontext]". So > > it's already a pretty massive abstraction layer we have. But configfd > > would be yet another fd abstraction based on anonfds. > > The idea has been that a new fd type based on anonfds comes with an > > api specific to that type of fd. That seems way nicer from an api > > design perspective than implementing new apis as part of yet another > > generic configfd layer. > > Really, it's just a fd that gathers config information and can reserve > specific errors (and we should really work out the i18n implications of It's rather a complex multiplexer intended to go beyond the realm of filesystems/mount api and that's something we have been burned by before. > the latter). Whether it's a new fd type or an anonfd with a specific > name doesn't seem to be that significant, so the name could be set by > the type. > > > Another problem is that these syscalls here would be massive > > multiplexing syscalls. If they are ever going to be used outside of > > filesystem use-cases (which is doubtful) they will quickly rival > > prctl(), seccomp(), and ptrace(). > > Actually, that's partly the point. We do have several systemcalls with Actually I think that's the problem. The keyctl api itself suffers from the problem that it already has a complex multiplexer. That could either point to bad api design (sorry, David :)) or it's just a very complex use-case like the mount api. The good thing is that it's restricted to a single domain: keys. And that's good. Plumbing both e.g. keys and (parts of) mounts on top of another generic api is what strikes me as a bad idea. > variable argument parsing that would benefit from an approach like > this. keyctl springs immediately to mind. > > > That's not a great thing. Especially, since we recently (a few > > months ago with Linus chiming in too) had long discussions with the > > conclusion that multiplexing syscalls are discouraged, from a > > security and api design perspective. Especially when they are not > > tied to a specific API (e.g. seccomp() and bpf() are at least tied to > > a specific API). libcs such as glibc and musl had reservations in > > that regard as well. > > > > This would also spread the mount api across even more fd types than > > it already does now which is cumbersome for userspace. > > > > A generic API like that also makes it hard to do interception in > > userspace which is important for brokers such as e.g. used in Firefox > > or what we do in various container use-cases. > > > > So I have strong reservations about configfd and would strongly favor > > the revival of the original fsconfig() patchset. > > Ah well, I did have plans for configfd to be self describing, so the > arguments accepted by each type would be typed and pre-registered and > thus parseable generically, so instead of being the usual anonymous > multiplex sink, it would at least be an introspectable multiplexed > sink. The problem there was I can't make fsconfig fit into that We already have fsconfig() to configure mounts so it seems odd to now spread the mount api onto configfd imho. Christian