Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp744423pxb; Thu, 21 Jan 2021 20:16:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxONbhqpoL9rxwDp+fTCAV0oIfK+6hbWftWHElcU2uHXREa3DmwQZCqiH0/nv7hTPrti698 X-Received: by 2002:a05:6402:1005:: with SMTP id c5mr1774173edu.379.1611288996212; Thu, 21 Jan 2021 20:16:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611288996; cv=none; d=google.com; s=arc-20160816; b=ckKwnf6xMOIzUGyzw8lrcO6i0YOU9EUBOYDntVVkcMAKW2+ItzG6SIxTMZKNX1OL7T Zt/lnrkuuKlFDwK6kauXQ6pFZcWna71u85pY9NYo35goziSnNs7JHQdR7JPgarrdd3uC WgAV8UYicoBtlhUAc9+1i21UQrRofaB+v4iLNfgJcsSlV3MnbpS/qQdwQo30x3s1rrQr +6Bjp1zFZan+QUf9UImBZYtig1jqQMVx9xK8Eh7awpSHSZHUSRh6y5ua6V8U84kA6N/M 6+L7LpYuupk626t2ta9pfQNNmoRGEiDZI7NXruE6hA49vxlyrPiudpiL6DmFyDOT3B5u KcqQ== 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=JpQBCOcKojPbmSqI8cV8EoxvK3fFNyukOAdmsznFQEM=; b=rrQEKz0pd4EKe7nC/x4PSkYf8g4AYgPRUbbdEpzEmsMYqa+6N8n8ytcUAAvYspmADa uA6ek7++3HafrXmIBKOCuVyV8+Jk1R5kgV5iym3yeN5WeIloN2MGDZ7U5L+B1AOhBL5N 5QOPxxZZa/cDaIFbJt6zsqHxEEnqdaXExpIrq0d47qMxEFMKNfwsfluEjOj5m7bHzJKh RjKltJWLTs1cyjULdnprTWColB1qn5d7OtJmmymKpedB7IZa9bBA2hSesOZaAGLKkSif 6lvjooFZ1IJpWy30qyHWv/TliKgx5oF9OJW1mbGEQBB92Z9/WkngelOrbghuyBiwiUFG 7Teg== 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 sb9si2700715ejb.366.2021.01.21.20.16.07; Thu, 21 Jan 2021 20:16:36 -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 S1726472AbhAVEQF (ORCPT + 99 others); Thu, 21 Jan 2021 23:16:05 -0500 Received: from namei.org ([65.99.196.166]:52828 "EHLO mail.namei.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbhAVEQE (ORCPT ); Thu, 21 Jan 2021 23:16:04 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.namei.org (Postfix) with ESMTPS id 4E2B41BC; Fri, 22 Jan 2021 04:14:30 +0000 (UTC) Date: Fri, 22 Jan 2021 15:14:30 +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 16/40] open: handle idmapped mounts In-Reply-To: <20210121131959.646623-17-christian.brauner@ubuntu.com> Message-ID: References: <20210121131959.646623-1-christian.brauner@ubuntu.com> <20210121131959.646623-17-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: > For core file operations such as changing directories or chrooting, > determining file access, changing mode or ownership the vfs will verify > that the caller is privileged over the inode. Extend the various helpers > to handle idmapped mounts. If the inode is accessed through an idmapped > mount map it into the mount's user namespace. Afterwards the permissions > checks are identical to non-idmapped mounts. When changing file > ownership we need to map the uid and gid 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-24-christian.brauner@ubuntu.com > Cc: Christoph Hellwig > Cc: David Howells > Cc: Al Viro > Cc: linux-fsdevel@vger.kernel.org > Signed-off-by: Christian Brauner Reviewed-by: James Morris -- James Morris