Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp733134pxb; Thu, 21 Jan 2021 19:50:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxilHHAjPyvkd0NlXpOSWX62LEIzWJzDef74FdKTeuOue0UagBIocPyykL3Ibz21cQvODl/ X-Received: by 2002:a50:fb0e:: with SMTP id d14mr1643691edq.369.1611287406415; Thu, 21 Jan 2021 19:50:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611287406; cv=none; d=google.com; s=arc-20160816; b=uIKmafxjcIlRfGU3+E8m3WmPeOwA9+S5vbOATDeQKd2yqGfoV1MW9WxNGdlTvQ5p/a 6I8sFcCWq+3AHgbCm+QelJonVhtIaYmnti4ueCUGOwqhBTmDudnwwsAeIicVlzVKwcha zAMtZA/F1sitCFRqjc8SNUBS8TePODZRrkXFKcv4Q4hiPAiD8SatCzYowHlR6sbhqT1G 2KNhLqzrtgBs4SHeUQWLjl8vsCNJF+h3/A1ZyiVyMSpF982snL0qDITI6qUrQ7MORwBW NI/KMa/Pkhejfoq5OzzJHMA5xhtX1XJfEB5ks5ARbaFYvGOZ2h477dZm/LCZw4xff4CF QUqg== 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=/lRb54maLFIAGzLW1HcA1Li7gLOd98iGBOUc6py+lfA=; b=txWRw/qg19tnNS5AqvmS0f2eTjU0ItoB7vwEFHu6mEEYG8HYdcASvMMc/2BDAHGZsb v9wsC7YmceDdmKqcRst2qJM8B2SOUb4sgRpuuw5SlCATinDehgRWxZTH7OK1YC9ikIMr sK9Nj6VPV1KPWh38Jcx61XHpfeQD6PL6ANYUs+FC5hkG91eVmhK/UHll5TuVHwB27w2Q wNy4SRKPBAGLphZpWWl4UBoQ6dBq0n2Sh1WZo+EOfidP6sg8OBGl14Lkt1BsCYbGpOcA tHFxmwJfJVTNnNejiQYInUIHdATZrX8heVY6zhLGlP/6dgzMrNEzBE0+LD8w+xnmG9PD d1PA== 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 dd20si3047962edb.489.2021.01.21.19.49.41; Thu, 21 Jan 2021 19:50:06 -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 S1726261AbhAVDte (ORCPT + 99 others); Thu, 21 Jan 2021 22:49:34 -0500 Received: from namei.org ([65.99.196.166]:52776 "EHLO mail.namei.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbhAVDtc (ORCPT ); Thu, 21 Jan 2021 22:49:32 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.namei.org (Postfix) with ESMTPS id 1847E8CE; Fri, 22 Jan 2021 03:47:59 +0000 (UTC) Date: Fri, 22 Jan 2021 14:47:59 +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 12/40] namei: handle idmapped mounts in may_*() helpers In-Reply-To: <20210121131959.646623-13-christian.brauner@ubuntu.com> Message-ID: <2ec5e6b6-768c-dad-3365-53c129579eb@namei.org> References: <20210121131959.646623-1-christian.brauner@ubuntu.com> <20210121131959.646623-13-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 may_follow_link(), may_linkat(), may_lookup(), may_open(), > may_o_create(), may_create_in_sticky(), may_delete(), and may_create() > helpers determine whether the caller is privileged enough to perform the > associated operations. Let them handle idmapped mounts by mapping the > inode or fsids according to the mount's user namespace. Afterwards the > checks are identical to non-idmapped inodes. The patch takes care to > retrieve the mount's user namespace right before performing permission > checks and passing it down into the fileystem so the user namespace > can't change in between by someone idmapping a mount that is currently > not idmapped. 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-20-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