Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5151332ybv; Mon, 17 Feb 2020 13:26:14 -0800 (PST) X-Google-Smtp-Source: APXvYqy27B0MDoiXa3342yJNOceNDCcuXOhZ8aRssFFK8cF/LGPZMbZLDonlZC+A0dVOn5ya2L7L X-Received: by 2002:a54:480c:: with SMTP id j12mr627961oij.130.1581974774733; Mon, 17 Feb 2020 13:26:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581974774; cv=none; d=google.com; s=arc-20160816; b=t9h0zXaHhk/yNrGnPDZ8H06tcuU0JNZkscmn9MtjjG8PnFhn0z7CXPg4p1Ro9IWZbU hsW4WwON2uk25T11h6zUq0rjGzodHrgS71M2eQTWCLVL1bowCOHPzPTB48s97vCvx7li TE/ZK+XYXv0cFAkHPPWbLEvxmBkAyX1D3mZnT8tllh5q1N6AuR3s1GTW2utFMu8uGfvZ gXYHRwDzpkHwVFznBXREd91fOq6szXgiWZg66DqZBpws6CRGNBtuAem2XEZxx/jbfe42 Ibnkr+xyt4Q4m60mUujarZXdDgtaeIWWrloGGBElF8YG8oAbL9IZ5nEULRE5vP2/cKIL Z8+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=16SpGwGsFtnqd6/l13TL1PycGx3w+yMr4PLe1rYTmzM=; b=BFOskHxHcB55h+VhXT8xHlXiQY3PiH5XLFMQkWFxfwaR17CRkFOkJBAJpR2QMrkU5d M81H2QX6ObQZWpby9qXmC3TKqLavFnTdWR82OTJUpjOw/56Y9yU6Udv1dt0fF8v/zJ4R xiWF83k0h1tRWPbMz7Ft0/PtG1EP8tQF3wm87Ey+g8fujgApvCB6fs+oXnKMQwzioGv4 IYUZhEq30pA60ghqusO9rj9Aj2t6gNwGCDJZ9wnM9QjWVJJwavU+9ILPON3HgewSZV70 m4pmyUkUKlBY6y7AsQFsLtdvgTmTvmKt5Fu1zGG3xjbC8Uk9xlH5RlEa0YwTjkyq3eMP RD1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si7269165oii.80.2020.02.17.13.26.02; Mon, 17 Feb 2020 13:26:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729921AbgBQVUh (ORCPT + 99 others); Mon, 17 Feb 2020 16:20:37 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:55236 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728254AbgBQVUg (ORCPT ); Mon, 17 Feb 2020 16:20:36 -0500 Received: from ip5f5bf7ec.dynamic.kabel-deutschland.de ([95.91.247.236] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1j3noV-0004NS-OY; Mon, 17 Feb 2020 21:20:23 +0000 Date: Mon, 17 Feb 2020 22:20:22 +0100 From: Christian Brauner To: James Bottomley Cc: =?utf-8?B?U3TDqXBoYW5l?= Graber , "Eric W. Biederman" , Aleksa Sarai , Jann Horn , Kees Cook , Jonathan Corbet , linux-kernel@vger.kernel.org, containers@lists.linux-foundation.org, smbarber@chromium.org, Seth Forshee , linux-security-module@vger.kernel.org, Alexander Viro , linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexey Dobriyan Subject: Re: [PATCH v2 00/28] user_namespace: introduce fsid mappings Message-ID: <20200217212022.2rfex3qsdjyyqrq7@wittgenstein> References: <20200214183554.1133805-1-christian.brauner@ubuntu.com> <1581973568.24289.6.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1581973568.24289.6.camel@HansenPartnership.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 17, 2020 at 01:06:08PM -0800, James Bottomley wrote: > On Fri, 2020-02-14 at 19:35 +0100, Christian Brauner wrote: > [...] > > People not as familiar with user namespaces might not be aware that > > fsid mappings already exist. Right now, fsid mappings are always > > identical to id mappings. Specifically, the kernel will lookup fsuids > > in the uid mappings and fsgids in the gid mappings of the relevant > > user namespace. > > This isn't actually entirely true: today we have the superblock user > namespace, which can be used for fsid remapping on filesystems that > support it (currently f2fs and fuse). Since this is a single shift, Note that this states "the relevant" user namespace not the caller's user namespace. And the point is true even for such filesystems. fuse does call make_kuid(fc->user_ns, attr->uid) and hence looks up the mapping in the id mappings.. This would be replaced by make_kfsuid(). > how is it going to play with s_user_ns? Do you have to understand the > superblock mapping to use this shift, or are we simply using this to > replace s_user_ns? I'm not sure what you mean by understand the superblock mapping. The case is not different from the devpts patch in this series. Fuse needs to be changed to call make_kfsuid() since it is mountable inside user namespaces at which point everthing just works.