Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp717935pxb; Thu, 21 Jan 2021 19:12:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNBN1ngJZshsV/eTe7hD7fIuJ051Zp43yz5jW0pOBK3YpoDyaW/X1kQMUi1YIrsr8CdTFH X-Received: by 2002:aa7:d78e:: with SMTP id s14mr1616274edq.329.1611285148818; Thu, 21 Jan 2021 19:12:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611285148; cv=none; d=google.com; s=arc-20160816; b=s0Ko1LNcyFtQBFeVGCu/LNnrDFq/EDEic/ho10RnvctIsWhsR8vU1bJhSQFZr0KsCd rvthUi44jt4UjIeujY9sOdZblEfxDXeFT3kNya/8mb2PEzBEjwxZb4cKkU3IT/HPYQLR yP2HJIQ/8XJcdMLxnYZR82T+nbE0LOoTWaOGNXvLl2IoyeTrApOhf0nD1IwjD4aYw+Xa txJRmisDNA1KGNxCyBZlQRpM5UeaS5Zewo6BlkMfZgKBNZaxtfkbWqx3WBBDelE2HMiA qsc8aFrkjrO7y7bFW59CGrCC7p5Q7DruclFyvtkBnJhWcIGoK7T84PMSI9MZUXi/0Htf xzug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date; bh=EWSyhLPM9e8wWo80g2FNAnIQWQ2nVYh2ig5D9C82368=; b=RCh6+fAkth/3z3sYKf1vlhPwTfEh2mT64dZ/MnHcRx7yvCGAl8juxj7IGLVkV7D5kR Q6AqA+ixM1zu+jRigmMON3qAyG58zbsLVrjclBsCW1GMxlZbewQIee6MXa7hzhMRtH34 5JJI2NLwu+BYefldv92xlCWZzgH/I7IETnqx0nYrjK+IkxlKeQGV+F5GtJGVwYXkcocV 6WFqLAj1/rgMGpRUOGi8Og0fHocJfeDnIlxd6zyJcM78Soa8vqCrFCOCrFUjsAq3Wjhq fr4YaXyYwDmeBPwX8QFGVeF2Akrxwanfu1oHo8G1RMWS9ntrn5bwaJrF2LU6ioGDeI+v zz1Q== 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 t13si2947183edw.20.2021.01.21.19.12.04; Thu, 21 Jan 2021 19:12:28 -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 S1726727AbhAVDLn (ORCPT + 99 others); Thu, 21 Jan 2021 22:11:43 -0500 Received: from namei.org ([65.99.196.166]:52526 "EHLO mail.namei.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726704AbhAVDLk (ORCPT ); Thu, 21 Jan 2021 22:11:40 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.namei.org (Postfix) with ESMTPS id 30E8249C; Fri, 22 Jan 2021 03:10:07 +0000 (UTC) Date: Fri, 22 Jan 2021 14:10:07 +1100 (AEDT) From: James Morris To: Christian Brauner cc: Alexander Viro , Christoph Hellwig , linux-fsdevel@vger.kernel.org, John Johansen , 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-15?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 Subject: Re: [PATCH v6 06/40] inode: make init and permission helpers idmapped mount aware In-Reply-To: <20210121131959.646623-7-christian.brauner@ubuntu.com> Message-ID: <27cf2bc-6f4b-289-d691-4f8845cf671c@namei.org> References: <20210121131959.646623-1-christian.brauner@ubuntu.com> <20210121131959.646623-7-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, 21 Jan 2021, Christian Brauner wrote: > The inode_owner_or_capable() helper determines whether the caller is the > owner of the inode or is capable with respect to that inode. Allow it to > handle idmapped mounts. If the inode is accessed through an idmapped > mount it according to the mount's user namespace. Afterwards the checks > are identical to non-idmapped mounts. If the initial user namespace is > passed nothing changes so non-idmapped mounts will see identical > behavior as before. > > Similarly, allow the inode_init_owner() helper to handle idmapped > mounts. It initializes a new inode on idmapped mounts by mapping the > fsuid and fsgid of the caller from the mount's user namespace. If the > initial user namespace is passed nothing changes so non-idmapped mounts > will see identical behavior as before. > > Link: https://lore.kernel.org/r/20210112220124.837960-13-christian.brauner@ubuntu.com > Cc: Christoph Hellwig > Cc: David Howells > Cc: Al Viro > Cc: linux-fsdevel@vger.kernel.org > Reviewed-by: Christoph Hellwig > Signed-off-by: Christian Brauner Reviewed-by: James Morris -- James Morris