Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753653AbbGOVNG (ORCPT ); Wed, 15 Jul 2015 17:13:06 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:57428 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752957AbbGOVND (ORCPT ); Wed, 15 Jul 2015 17:13:03 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Casey Schaufler Cc: Seth Forshee , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, Serge Hallyn , Andy Lutomirski , linux-kernel@vger.kernel.org References: <1436989569-69582-1-git-send-email-seth.forshee@canonical.com> <55A6C448.5050902@schaufler-ca.com> Date: Wed, 15 Jul 2015 16:06:35 -0500 In-Reply-To: <55A6C448.5050902@schaufler-ca.com> (Casey Schaufler's message of "Wed, 15 Jul 2015 13:36:24 -0700") Message-ID: <87vbdlf7vo.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX18n6XUyiT9Cwgrw8V09v2iiYrSUlpxXc5s= X-SA-Exim-Connect-IP: 67.3.205.90 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 * 1.5 XMNoVowels Alpha-numberic number with no vowels * 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.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa01 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa01 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Casey Schaufler X-Spam-Relay-Country: X-Spam-Timing: total 1670 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 3.7 (0.2%), b_tie_ro: 2.5 (0.1%), parse: 1.32 (0.1%), extract_message_metadata: 37 (2.2%), get_uri_detail_list: 5 (0.3%), tests_pri_-1000: 12 (0.7%), tests_pri_-950: 2.1 (0.1%), tests_pri_-900: 1.63 (0.1%), tests_pri_-400: 47 (2.8%), check_bayes: 45 (2.7%), b_tokenize: 18 (1.1%), b_tok_get_all: 12 (0.7%), b_comp_prob: 7 (0.4%), b_tok_touch_all: 3.6 (0.2%), b_finish: 0.87 (0.1%), tests_pri_0: 710 (42.5%), tests_pri_500: 850 (50.9%), poll_dns_idle: 840 (50.3%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 0/7] Initial support for user namespace owned mounts X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -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 Content-Length: 4275 Lines: 90 Casey Schaufler writes: > On 7/15/2015 12:46 PM, Seth Forshee wrote: >> These are the first in a larger set of patches that I've been working on >> (with help from Eric Biederman) to support mounting ext4 and fuse >> filesystems from within user namespaces. I've pushed the full series to: >> >> git://kernel.ubuntu.com/sforshee/linux.git userns-mounts >> >> Taking the series as a whole, the strategy is to handle as much of the >> heavy lifting as possible in the vfs so the filesystems don't have to >> handle weird edge cases. If you look at the full series you'll find that >> the changes in ext4 to support user namespace mounts turn out to be >> fairly minimal (fuse is a bit more complicated though as it must deal >> with translating ids for a userspace process which is running in pid and >> user namespaces). >> >> The patches I'm sending today lay some of the groundwork in the vfs and >> related code. They fall into two broad groups: >> >> 1. Patches 1-2 add s_user_ns and simplify MNT_NODEV handling. These are >> pretty straightforward, and Eric has expressed interest in merging >> these patches soon. Note that patch 2 won't apply cleanly without >> Eric's noexec patches for proc and sys [1]. >> >> 2. Patches 2-7 tighten down security for mounts with s_user_ns != >> &init_user_ns. This includes updates to how file caps and suid are >> handled and LSM updates to ignore security labels on superblocks >> from non-init namespaces. >> >> The LSM changes in particular may not be optimal, as I don't have a >> lot of familiarity with this code, so I'd be especially appreciative >> of review of these changes and suggestions on how to improve them. > > Lukasz Pawelczyk proposed > LSM support in user namespaces ([RFC] lsm: namespace hooks) > that make a whole lot more sense than just turning off > the option of using labels on files. Gutting the ability > to use MAC in a namespace is a step down the road of > making MAC and namespaces incompatible. This is not "turning off the option to use labels on files". This is supporting mounting filesystems like ext4 by unprivileged users and not trusting the labels they set in the same way as we trust labels on filesystems mounted by privileged users. The first step needs to be not trusting those labels and treating such filesystems as filesystems without label support. I hope that is Seth has implemented. In the long run we can do more interesting things with such filesystems once the appropriate LSM policy is in place. Getting s_user_ns present on struct super, properly set, and all of the appropriate checks against it present in the vfs so that filesystems don't need to duplicate logic is important if we are going do more interesting things with user namespaces (as users have been asking for). It is important for things as small as making it safe to allow truly unprivileged users to mount fuse filesystems. I am on the fence with Lukasz Pawelczyk's patches. Some parts I liked some parts I had issues with. As I recall one of my issues was that those patches conflicted in detail if not in principle with this appropach. If these patches do not do a good job of laying the ground work for supporting security labels that unprivileged users can set than Seth could really use some feedback. Figuring out how to properly deal with the LSMs has been one of his challenges. I am hoping I can finishing working through the patches to fix the semantics of rename and bind mounts before the next merge window opens, so I can have enough cycles to lift the feature freeze on user namespaces. Except for maybe his first two patches (which fix a small userspace API breakage) none of Seth's patches get to go in until I lift the freeze. Which is probably too much information but I hope this makes it clear that the point of this work is as an enabler for future developments, not as something to make user namespaces and LSMs incompatible. Eric -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/