From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out02.mta.xmission.com ([166.70.13.232]:58638 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751287AbcFUTpl (ORCPT ); Tue, 21 Jun 2016 15:45:41 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Andy Lutomirski Cc: Linux Containers , Linux FS Devel , Miklos Szeredi , James Bottomley , Djalal Harouni , Seth Forshee , "Serge E. Hallyn" References: <87fus77pns.fsf@x220.int.ebiederm.org> <20160620172130.15712-1-ebiederm@xmission.com> <20160620172130.15712-2-ebiederm@xmission.com> Date: Tue, 21 Jun 2016 13:54:21 -0500 In-Reply-To: (Andy Lutomirski's message of "Mon, 20 Jun 2016 15:53:58 -0700") Message-ID: <874m8m4bky.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [PATCH review 02/13] mnt: Refactor fs_fully_visible into mount_too_revealing Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Andy Lutomirski writes: > On Mon, Jun 20, 2016 at 10:21 AM, Eric W. Biederman > wrote: >> Replace the call of fs_fully_visible in do_new_mount from before the >> new superblock is allocated with a call of mount_too_revealing after >> the superblock is allocated. This winds up being a much better location >> for maintainability of the code. >> >> The first change this enables is the replacement of FS_USERNS_VISIBLE >> with SB_I_USERNS_VISIBLE. Moving the flag from struct filesystem_type >> to sb_iflags on the superblock. > > Why is this useful? A couple of reasons. - It helps clean up do_new_mount which is currently so overloaded by special cases that it is difficult to see the core logic. - It makes the check about the actual superblock that is being mounted rather than the superblock that might be mounted. - The practical place where being about the actual superblock that is being mounted helps is that in "11/13 mnt: Simplify mount_too_revealing" that removes the MNT_LOCK_NOSUID MNT_LOCK_NOEXEC and MNT_LOCK_NODEV tests from the code, while verify that those tests are not needed because the sb_iflags contains SB_I_NOEXEC and SB_I_NODEV. - The conceptual change of testing once the superblock has been generated makes changes like the one above much more sensible and it helps untangle mount namespace versus superblock concerns. That last is a big part of what this patchset is about. When do we care about the superblock and when do we care about the mount namespace. Eric