From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755264AbcEEAXt (ORCPT ); Wed, 4 May 2016 20:23:49 -0400 Received: from ipmail07.adl2.internode.on.net ([150.101.137.131]:29585 "EHLO ipmail07.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752783AbcEEAXr (ORCPT ); Wed, 4 May 2016 20:23:47 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BoBwD6kSpX/8PVLHlegziBUIJzolUBAQEBAQEGjBuFbYQThgoEAgKBNk0BAQEBAQFmJ4RBAQEBAwE6HCMFCwgDDgoJJQ8FJQMhExuIBwe+HwEBAQEBBQEBAQEcGYU/hRSEEREBCIM/ghIcBZgZjg6Bcod2hTWGJokOYoIFBBeBXSowhx0IF4EeAQEB Date: Thu, 5 May 2016 10:23:14 +1000 From: Dave Chinner To: Djalal Harouni Cc: Alexander Viro , Chris Mason , tytso@mit.edu, Serge Hallyn , Josh Triplett , "Eric W. Biederman" , Andy Lutomirski , Seth Forshee , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Dongsu Park , David Herrmann , Miklos Szeredi , Alban Crequy Subject: Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Message-ID: <20160505002314.GB26977@dastard> References: <1462372014-3786-1-git-send-email-tixxdz@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1462372014-3786-1-git-send-email-tixxdz@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 04, 2016 at 04:26:46PM +0200, Djalal Harouni wrote: > This is version 2 of the VFS:userns support portable root filesystems > RFC. Changes since version 1: > > * Update documentation and remove some ambiguity about the feature. > Based on Josh Triplett comments. > * Use a new email address to send the RFC :-) > > > This RFC tries to explore how to support filesystem operations inside > user namespace using only VFS and a per mount namespace solution. This > allows to take advantage of user namespace separations without > introducing any change at the filesystems level. All this is handled > with the virtual view of mount namespaces. [...] > As an example if the mapping 0:65535 inside mount namespace and outside > is 1000000:1065536, then 0:65535 will be the range that we use to > construct UIDs/GIDs mapping into init_user_ns and use it for on-disk > data. They represent the persistent values that we want to write to the > disk. Therefore, we don't keep track of any UID/GID shift that was applied > before, it gives portability and allows to use the previous mapping > which was freed for another root filesystem... So let me get this straight. Two /isolated/ containers, different UID/GID mappings, sharing the same files and directories. Create a new file in a writeable directory in container 1, namespace information gets stripped from on-disk uid/gid representation. Container 2 then reads that shared directory, finds the file written by container 1. As there is no no namespace component to the uid:gid stored in the inode, we apply the current namespace shift to the VFS inode uid/gid and so it maps to root in container 2 and we are allowed to read it? Unless I've misunderstood something in this crazy mapping scheme, isn't this just a vector for unintentional containment breaches? [...] > Simple demo overlayfs, and btrfs mounted with vfs_shift_uids and > vfs_shift_gids. The overlayfs mounts will share the same upperdir. We > create two user namesapces every one with its own mapping and where > container-uid-2000000 will pull changes from container-uid-1000000 > upperdir automatically. Ok, forget I asked - it's clearly intentional. This is beyond crazy, IMO. > 3) ROADMAP: > =========== > * Confirm current design, and make sure that the mapping is done > correctly. How are you going to ensure that all filesystems behave the same, and it doesn't get broken by people who really don't care about this sort of crazy? FWIW, having the VFS convert things to "on-disk format" is an oxymoron - the "V" in VFS means "virtual" and has nothing to do with disks or persistent storage formats. Indeed, let's convert the UID to "on-disk" format for a network filesystem client.... ..... > * Add XFS support. What is the problem here? Next question: how does this work with uid/gid based quotas? Cheers, Dave. -- Dave Chinner david@fromorbit.com