Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1006576ybv; Wed, 19 Feb 2020 13:56:52 -0800 (PST) X-Google-Smtp-Source: APXvYqxBuaEioVqC9uagRKxTrJ/RpEEYe8kEPPNst5/wFMSLGTTvIC+QvDEgE4XiWHEl7ClVC+Kn X-Received: by 2002:a05:6830:4a4:: with SMTP id l4mr21381012otd.91.1582149412417; Wed, 19 Feb 2020 13:56:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582149412; cv=none; d=google.com; s=arc-20160816; b=DY6mY/f7vMJjJ60CS/5gSDT8re44BAbs93WQxso+fWaXTodJNgEIvinF4IxXKisy8u i8ATiHVYpLWZgIjtF39glMZbcZS2zmmwJmjYpsehvicN9Fkf2asmFJMynh4wnAAcac5m BPQyCYv6kSiuCyNZvd2Ci5OJBIUuEuuU1TLZQcY+vaxfPQ3352ilh5NNbO/GUGiBr3p6 hg+xXZZOVTz6ZgUFB25gJcdcaYYC3FK9RCBlZiatm10z1L/87isJJI8sodMAaMAaGNWd lx9R+Ex/gJPi6LR2sdM79NKOYvhH/3Erl42XpswnZ740+J5MJC8wPHje1RZKg2HEdYHi U+Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Azu2hLv1JxMDvmUxRW44SGEWy8s3ld4pghrW56XCt6M=; b=MsP/LqRUT6CIOuQ8WrSusoMKd6fUDi6Xc217QQ/U6a5Qy5VgQMRjrbpATiscjmIKDX jVzRTMr6T/A20XDYCSCjZTcG/7cqWqRO3kY2YlDdHHc1mQqBOX5brIdvIRf2m/hp1xUG MIJZIPBhcXUmcYpmzSoGwlRPdRYKPYQpPl4g4FFfryQDN0jIJAI//+kxofPm4I+d5BPH Siha1pSpfkG2fX3qmJrCjm4hyDhibpmn/5k/bV4K1D325qjCFilpYpfKP3duY0ICJYsM GlS9B21w9g+djjdOLaQ2RRyRjbazmRIco/tH+d7fmfDZdZpcp9ycIAZdcJxUChkGUd2z D6pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=c7TWOHvd; 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 l83si9929659oih.58.2020.02.19.13.56.39; Wed, 19 Feb 2020 13:56:52 -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; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=c7TWOHvd; 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 S1727326AbgBSV4d (ORCPT + 99 others); Wed, 19 Feb 2020 16:56:33 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39079 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727429AbgBSV4d (ORCPT ); Wed, 19 Feb 2020 16:56:33 -0500 Received: by mail-pl1-f193.google.com with SMTP id g6so638160plp.6 for ; Wed, 19 Feb 2020 13:56:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho-ws.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Azu2hLv1JxMDvmUxRW44SGEWy8s3ld4pghrW56XCt6M=; b=c7TWOHvdXbs8XVMlR8ak2j2dOVotN58THB1IoCFTfPwhfZYSyCThOf4Uwt/h/YiwTP C4f4cNiGmf3g+/JTB/nmySLtHFkNcbsTdphZ/X3OO5zOvQh31wXuIUh6Td8HLEdp4YOv fslV+YGcPP6RMcuohrbQMoofsTra+Jk2AU22gjMavwfOBgJ74L81QUv6AEgDr5xRGvkA 3Ki/uS5ldmhYscfAaN0autLmj3+AAsssZVj4lH2DjcGS/hNAljyhttLK9TX0XHRtl4TP LsjsfAVYCa9xD1tl6Wb8kuejT/AlU9opB8F2FNk7IVwCJO3Dc5E+cFU9JrwID4No3Pkr ATjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Azu2hLv1JxMDvmUxRW44SGEWy8s3ld4pghrW56XCt6M=; b=tSjs9l3cnZY8a8f34YwHhX39iTege1yRFXlPYZiwBm2tBZC3Fyz6DEpk0zCsMFF/Dx TRiDBrbMShiqNNEnCgODfooFng95yY+OcMuksLmFDEgWmFCJ9BlBy+pfUZyWhxyqwrJK 6R0NdOjLb/hoOVi3Pgj7Fg2zOweGZnudvciY5UkoZFRSC4yqvGo3yhhTynF6W14VlNKI 6ftXYk+CgL9fh3sEOYV+HrHI1m6KCmBwv23vf+tMUPEJnJ1U2b0Mkl9s2957ATfXTtot JPrTNsrsCMaTeIignvYozHnWJTjFfBs7oAY8SgUvrxw+2AG/AxWC/5c6VO5+Yxan8xeX +JDw== X-Gm-Message-State: APjAAAWl8+jshSPxNQjLZ4hiWdnThWLBhN8/wmrDXHB2bECItyiS92jZ gQbP15wA62Zc68ASO5ES9+nY7g== X-Received: by 2002:a17:90a:3841:: with SMTP id l1mr11289750pjf.108.1582149392531; Wed, 19 Feb 2020 13:56:32 -0800 (PST) Received: from cisco ([2001:420:c0c8:1007::7a1]) by smtp.gmail.com with ESMTPSA id f8sm608035pfn.2.2020.02.19.13.56.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 13:56:31 -0800 (PST) Date: Wed, 19 Feb 2020 14:56:23 -0700 From: Tycho Andersen To: "Serge E. Hallyn" Cc: Christian Brauner , =?iso-8859-1?Q?St=E9phane?= Graber , "Eric W. Biederman" , Aleksa Sarai , Jann Horn , smbarber@chromium.org, Seth Forshee , Alexander Viro , Alexey Dobriyan , James Morris , Kees Cook , Jonathan Corbet , Phil Estes , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, containers@lists.linux-foundation.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH v3 00/25] user_namespace: introduce fsid mappings Message-ID: <20200219215623.GA11724@cisco> References: <20200218143411.2389182-1-christian.brauner@ubuntu.com> <20200219193558.GA27641@mail.hallyn.com> <20200219214837.GA29159@mail.hallyn.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200219214837.GA29159@mail.hallyn.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 19, 2020 at 03:48:37PM -0600, Serge E. Hallyn wrote: > On Wed, Feb 19, 2020 at 01:35:58PM -0600, Serge E. Hallyn wrote: > > On Tue, Feb 18, 2020 at 03:33:46PM +0100, Christian Brauner wrote: > > > With fsid mappings we can solve this by writing an id mapping of 0 > > > 100000 100000 and an fsid mapping of 0 300000 100000. On filesystem > > > access the kernel will now lookup the mapping for 300000 in the fsid > > > mapping tables of the user namespace. And since such a mapping exists, > > > the corresponding files will have correct ownership. > > > > So if I have > > > > /proc/self/uid_map: 0 100000 100000 > > /proc/self/fsid_map: 1000 1000 1 > > Oh, sorry. Your explanation in 20/25 i think set me straight, though I need > to think through a few more examples. > > ... > > > 3. If I create a new file, as nsuid 1000, what will be the inode owning kuid? > > (Note - I edited the quoted txt above to be more precise) > > I'm still not quite clear on this. I believe the fsid mapping will take > precedence so it'll be uid 1000 ? Per mount behavior would be nice there, > but perhaps unwieldy. The is_userns_visible() bits seems to be an attempt at understanding what people would want per-mount, with a policy hard coded in the kernel. But maybe per-mount behavior can be solved more elegantly with shifted bind mounts, so we can drop all that from this series, and ignore per-mount settings here? Tycho