Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2636802pxb; Sun, 24 Jan 2021 14:47:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8RdEqgmdRcImaxneGjU040pFMjcmazcsFi1fzBKxf3e3fKTJw0E3AA0Y9DED5dn445+Q2 X-Received: by 2002:a17:906:7b84:: with SMTP id s4mr505629ejo.520.1611528469197; Sun, 24 Jan 2021 14:47:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611528469; cv=none; d=google.com; s=arc-20160816; b=dbw5cc/xx8GDGwcvoj18fjgFo7Xt3zkxtn/bwNG/7h4zZKvSA7gwgBLo9wVTQUpdwZ H5/H5Gvcrh5zfDIFNqoEW3OKeeyw+X3lJdmPj1xq622ojsudLGVzi2qN1wzjpnSYxgs0 AwiUn7OsFOejuy55O4OwE0tWcC0bM4yU/XIH/KVHWwj2GLHNJQHWl54HXncquWc6BfZF nBtsp0DZZdMJrt90bTgO8tG60VySl3Gok7jc9BK0WfIICCf9DdRYyGHQvV9lVaJRZhRb j9Kr6a+yA/6zN8+xa7p1gglGBwTBni4P+STXQ6ROt3sDaDSW/kvSOXpaHo2slIoxLjYy PzkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=4F3ilXbCkW8o//883m7kYJv6ClzK0jgEwgsfzArqKsw=; b=xcg5ETsDJAhZRTLCunH3nWywlI893IwdZvumRbHHRbDU+NywCOsCEyJiq9n7U0fI3U WRPRX8tq71i2cqFKHXOB1d/kloRWQ3jpfFh6jXPu0/qDDUmo8U4pGKOTbo8pKtpvI6wj 8Ew02FPgiwDzX0HpD1EOpifAdc6zJLmPxltpjVMbQ0tiN8J9Nf6XSvUgk7OSWK2Vd8I+ h/IPFvky2WzU7bwKonxye/SwiRBpoGJtb82JFmd1Wzak2W8QG7T/ZCtkwcV54ABs+qVX vszShDphOWO256zkspJmMLaTTYH9NGxsUorphhPvmf+0/uYQdggi88/C+tdTXlsWilg5 3JTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 i5si6643673eds.603.2021.01.24.14.47.20; Sun, 24 Jan 2021 14:47:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726731AbhAXWpu (ORCPT + 99 others); Sun, 24 Jan 2021 17:45:50 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:47673 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726127AbhAXWps (ORCPT ); Sun, 24 Jan 2021 17:45:48 -0500 Received: from ip5f5af0a0.dynamic.kabel-deutschland.de ([95.90.240.160] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1l3o7r-0007VN-AX; Sun, 24 Jan 2021 22:44:55 +0000 Date: Sun, 24 Jan 2021 23:44:50 +0100 From: Christian Brauner To: "J. Bruce Fields" Cc: Alexander Viro , Christoph Hellwig , linux-fsdevel@vger.kernel.org, John Johansen , James Morris , Mimi Zohar , Dmitry Kasatkin , Stephen Smalley , Casey Schaufler , Arnd Bergmann , Andreas Dilger , OGAWA Hirofumi , Geoffrey Thomas , Mrunal Patel , Josh Triplett , Andy Lutomirski , Theodore Tso , Alban Crequy , Tycho Andersen , David Howells , James Bottomley , Seth Forshee , =?utf-8?B?U3TDqXBoYW5l?= Graber , Linus Torvalds , Aleksa Sarai , Lennart Poettering , "Eric W. Biederman" , smbarber@chromium.org, Phil Estes , Serge Hallyn , Kees Cook , Todd Kjos , Paul Moore , Jonathan Corbet , containers@lists.linux-foundation.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-integrity@vger.kernel.org, selinux@vger.kernel.org Subject: Re: [PATCH v6 05/39] namei: make permission helpers idmapped mount aware Message-ID: <20210124224450.3dtdgvwxpdf5niuz@wittgenstein> References: <20210121131959.646623-1-christian.brauner@ubuntu.com> <20210121131959.646623-6-christian.brauner@ubuntu.com> <20210122222632.GB25405@fieldses.org> <20210123130958.3t6kvgkl634njpsm@wittgenstein> <20210124221854.GA1487@fieldses.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210124221854.GA1487@fieldses.org> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sun, Jan 24, 2021 at 05:18:54PM -0500, J. Bruce Fields wrote: > On Sat, Jan 23, 2021 at 02:09:58PM +0100, Christian Brauner wrote: > > On Fri, Jan 22, 2021 at 05:26:32PM -0500, J. Bruce Fields wrote: > > > If I NFS-exported an idmapped mount, I think I'd expect idmapped clients > > > to see the mapped IDs. > > > > > > Looks like that means taking the user namespace from the struct > > > svc_export everwhere, for example: > > > > > > On Thu, Jan 21, 2021 at 02:19:24PM +0100, Christian Brauner wrote: > > > > index 66f2ef67792a..8d90796e236a 100644 > > > > --- a/fs/nfsd/nfsfh.c > > > > +++ b/fs/nfsd/nfsfh.c > > > > @@ -40,7 +40,8 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry) > > > > /* make sure parents give x permission to user */ > > > > int err; > > > > parent = dget_parent(tdentry); > > > > - err = inode_permission(d_inode(parent), MAY_EXEC); > > > > + err = inode_permission(&init_user_ns, > > > > + d_inode(parent), MAY_EXEC); > > > > > > err = inode_permission(exp->ex_path.mnt->mnt_userns, > > > d_inode(parent, MAY_EXEC); > > > > Hey Bruce, thanks! Imho, the clean approach for now is to not export > > idmapped mounts until we have ported that part of nfs similar to what we > > do for stacking filesystems for now. I've tested and taken this patch > > into my tree: > > Oh good, thanks. My real fear was that we'd fix this up later and leave > users in a situation where the server exposes different IDs depending on > kernel version, which would be a mess. Looks like this should avoid > that. > > As for making idmapped mounts actually work with nfsd--are you planning > to do that, or do you need me to? I hope the patch is straightforward; I'm happy to do it or help and there's other people I know who are also interested in that and would likely be happy to do the work too. > I'm more worried testing it. This whole series has a large xfstest patch associated with it that tests regular vfs behavior and vfs behavior with idmapped mounts. Iirc, xfstests also has infrastructure to test nfs. So I'd expect we expand the idmapped mounts testsuite to test nfs behavior as well. So far it has proven pretty helpful and has already unconvered an unrelated setgid-inheritance xfs bug that Christoph fixed a short time ago.