Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1552315pxb; Sun, 17 Jan 2021 13:15:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqHnKGf29YVlqLcboEHLXY6pFRejl0nqkzQnET5GbzrDcdo+Bxn7TdlwZrapMK4CdL7sl3 X-Received: by 2002:a17:906:c78b:: with SMTP id cw11mr13313300ejb.448.1610918152137; Sun, 17 Jan 2021 13:15:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610918152; cv=none; d=google.com; s=arc-20160816; b=Vz8YeQamQb8FkdmEqPtyliA8gBPk5xH1iLDCmBa8zXFPqNx19ZF6bmV2EtvRacvMBt F8MUSfumq6vs2Oe5qaJKv6Yn4hO4HdmyD0ywgfd4VBF03/MZaOYLzaBQByhFwnfB+ViR amvmGtrp2KZAE42aRTlNVPu57pJkofDxgsdjF95i/d6gP+qFnHR85DcbwrFw3sLqhjII WXJrqk3bnkKuIdx0Iok0n9NpxkOhdFCkty4z1zcNqGT2TJ/QMr4ycsMCqGC4Xl36ZIXz VOERn2oVn8NbjPW8j+bCNk3eXfl7LV+ZQ98KhIgKiIlLwHzYfSU54DCDPw/uF6Y2I/+r kd/g== 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=4fLjGNu/fKcpdHv3Uy2tymienCXB2CgA1JW790weaPU=; b=09Xeh0eRqHOAiMU7BSCt3uZM9bXuZYVue4JKMrhxZ491w/7OXFILjgR63+Tc/zrVK+ nbX5ywIhMgXlf2D5oGUXkRKoHO7bYbeOLso3cEB8e9+Eq9e2sSaFmjq1K0InunZoGup5 fyM/67Qt6LmYUBnl9P2IZsvMw5huy8J2qA5vb0ujUk6g9LemG+q7ckVwgKvWHjhttZ7I IMs2O2E3CVCdfe/JckFdZJg8l2jivDhQUazPinRMhBBofzOzZInGx1YHwcRtNaW+C1kz xr2hWlLVPN/zoyRkN4PERqvddZw9TmBlFZoI2rpKbQodVsRYo+Qf6WAU0BUkX3cEafSA Tl1w== 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 zo20si1477936ejb.302.2021.01.17.13.15.25; Sun, 17 Jan 2021 13:15:52 -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 S1730154AbhAQVHX (ORCPT + 99 others); Sun, 17 Jan 2021 16:07:23 -0500 Received: from mail107.syd.optusnet.com.au ([211.29.132.53]:44711 "EHLO mail107.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726785AbhAQVHW (ORCPT ); Sun, 17 Jan 2021 16:07:22 -0500 Received: from dread.disaster.area (pa49-181-54-82.pa.nsw.optusnet.com.au [49.181.54.82]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id AB1B4D5ED06; Mon, 18 Jan 2021 08:06:22 +1100 (AEDT) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1l1FFd-0011Hk-2N; Mon, 18 Jan 2021 08:06:21 +1100 Date: Mon, 18 Jan 2021 08:06:21 +1100 From: Dave Chinner To: Christian Brauner 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 , =?iso-8859-1?Q?St=E9phane?= 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, Christoph Hellwig Subject: Re: [PATCH v5 37/42] xfs: support idmapped mounts Message-ID: <20210117210621.GA78941@dread.disaster.area> References: <20210112220124.837960-1-christian.brauner@ubuntu.com> <20210112220124.837960-38-christian.brauner@ubuntu.com> <20210114205154.GL331610@dread.disaster.area> <20210114221048.ppf2pfuxrjak4kvm@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210114221048.ppf2pfuxrjak4kvm@wittgenstein> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=F8MpiZpN c=1 sm=1 tr=0 cx=a_idp_d a=NAd5MxazP4FGoF8nXO8esw==:117 a=NAd5MxazP4FGoF8nXO8esw==:17 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=7-415B0cAAAA:8 a=QsOiS33c3F2EFrvaDEcA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Jan 14, 2021 at 11:10:48PM +0100, Christian Brauner wrote: > On Fri, Jan 15, 2021 at 07:51:54AM +1100, Dave Chinner wrote: > > On Tue, Jan 12, 2021 at 11:01:19PM +0100, Christian Brauner wrote: > > > From: Christoph Hellwig > > > > > > Enable idmapped mounts for xfs. This basically just means passing down > > > the user_namespace argument from the VFS methods down to where it is > > > passed to helper. > > > > > > Signed-off-by: Christoph Hellwig > > .... > > > @@ -654,6 +658,7 @@ xfs_vn_change_ok( > > > */ > > > static int > > > xfs_setattr_nonsize( > > > + struct user_namespace *mnt_userns, > > > struct xfs_inode *ip, > > > struct iattr *iattr) > > > { > > > @@ -813,7 +818,7 @@ xfs_setattr_nonsize( > > > * Posix ACL code seems to care about this issue either. > > > */ > > > if (mask & ATTR_MODE) { > > > - error = posix_acl_chmod(&init_user_ns, inode, inode->i_mode); > > > + error = posix_acl_chmod(mnt_userns, inode, inode->i_mode); > > > if (error) > > > return error; > > > } > > > @@ -868,7 +873,7 @@ xfs_setattr_size( > > > * Use the regular setattr path to update the timestamps. > > > */ > > > iattr->ia_valid &= ~ATTR_SIZE; > > > - return xfs_setattr_nonsize(ip, iattr); > > > + return xfs_setattr_nonsize(&init_user_ns, ip, iattr); > > > > Shouldn't that be passing mnt_userns? > > Hey Dave, > > Thanks for taking a look. > > This is the time updating codepath. Yes, I understand the code path, that's why I asked the question and commented that it's a landmine. That is, if in future we ever need to do anything that is is in any way namespace related in the truncate path, the wrong thing will happen because we are passing the wrong namespace into that function. Please just pass down the correct namespace for the operation even though we don't currently require it for the operations being performed in that path. Cheers, Dave. -- Dave Chinner david@fromorbit.com