From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752295AbcEQWuq (ORCPT ); Tue, 17 May 2016 18:50:46 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:58481 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751911AbcEQWum (ORCPT ); Tue, 17 May 2016 18:50:42 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Seth Forshee Cc: Alexander Viro , Greg Kroah-Hartman , Jeff Layton , "J. Bruce Fields" , Tejun Heo , Li Zefan , Johannes Weiner , Serge Hallyn , Richard Weinberger , Austin S Hemmelgarn , Miklos Szeredi , Pavel Tikhomirov , linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, fuse-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, cgroups@vger.kernel.org In-Reply-To: <1461699046-30485-4-git-send-email-seth.forshee@canonical.com> (Seth Forshee's message of "Tue, 26 Apr 2016 14:30:26 -0500") References: <1461699046-30485-1-git-send-email-seth.forshee@canonical.com> <1461699046-30485-4-git-send-email-seth.forshee@canonical.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Date: Tue, 17 May 2016 17:39:33 -0500 Message-ID: <87shxgxqai.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX19F1ir8ehM4y26oi8CbiQIKahvD/8qC1uY= X-SA-Exim-Connect-IP: 97.119.107.188 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4987] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa04 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa04 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Seth Forshee X-Spam-Relay-Country: X-Spam-Timing: total 908 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 4.8 (0.5%), b_tie_ro: 3.4 (0.4%), parse: 1.17 (0.1%), extract_message_metadata: 16 (1.8%), get_uri_detail_list: 2.0 (0.2%), tests_pri_-1000: 6 (0.6%), tests_pri_-950: 1.14 (0.1%), tests_pri_-900: 0.97 (0.1%), tests_pri_-400: 23 (2.6%), check_bayes: 22 (2.4%), b_tokenize: 7 (0.8%), b_tok_get_all: 8 (0.8%), b_comp_prob: 1.88 (0.2%), b_tok_touch_all: 3.1 (0.3%), b_finish: 0.84 (0.1%), tests_pri_0: 847 (93.3%), check_dkim_signature: 0.45 (0.0%), check_dkim_adsp: 4.2 (0.5%), tests_pri_500: 3.6 (0.4%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v4 03/21] fs: Allow sysfs and cgroupfs to share super blocks between user namespaces X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Seth Forshee writes: > Both of these filesystems already have use cases for mounting the > same super block from multiple user namespaces. For sysfs this > happens when using criu for snapshotting a container, where sysfs > is mnounted in the containers network ns but the hosts user ns. > The cgroup filesystem shares the same super block for all mounts > of the same hierarchy regardless of the namespace. > > As a result, the restriction on mounting a super block from a > single user namespace creates regressions for existing uses of > these filesystems. For these specific filesystems this > restriction isn't really necessary since the backing store is > objects in kernel memory and thus the ids assigned from inodes > is not subject to translation relative to s_user_ns. > > Add a new filesystem flag, FS_USERNS_SHARE_SB, which when set > causes sget_userns() to skip the check of s_user_ns. Set this > flag for the sysfs and cgroup filesystems to fix the > regressions. So this one needs to be sget_userns(..., &init_user_ns, ...). And not a new special case. Apologies for not catching this earlier. I am looking at folding all of this into the patch that introduces sget_userns so that even bisects won't have regresssions. We loose the ability to call mount -o remount and actually affect these filesystems (which we don't have without s_user_ns) but we gain a whole lot of simplicity, and we don't break the xattr and security label on sysfs code. Eric