Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752241AbbGPExj (ORCPT ); Thu, 16 Jul 2015 00:53:39 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:35078 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750801AbbGPExe (ORCPT ); Thu, 16 Jul 2015 00:53:34 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Casey Schaufler Cc: Andy Lutomirski , Seth Forshee , Alexander Viro , Linux FS Devel , LSM List , SELinux-NSA , Serge Hallyn , "linux-kernel\@vger.kernel.org" References: <1436989569-69582-1-git-send-email-seth.forshee@canonical.com> <55A6C448.5050902@schaufler-ca.com> <87vbdlf7vo.fsf@x220.int.ebiederm.org> <55A6E107.3070200@schaufler-ca.com> <55A71CE3.4050708@schaufler-ca.com> Date: Wed, 15 Jul 2015 23:47:08 -0500 In-Reply-To: <55A71CE3.4050708@schaufler-ca.com> (Casey Schaufler's message of "Wed, 15 Jul 2015 19:54:27 -0700") Message-ID: <87fv4owvxv.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: U2FsdGVkX1+NrfN2yYIi9MsGViwINB3eNUVzUdl3wWI= 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.5001] * -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 1773 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 4.4 (0.2%), b_tie_ro: 3.1 (0.2%), parse: 1.34 (0.1%), extract_message_metadata: 28 (1.6%), get_uri_detail_list: 4.8 (0.3%), tests_pri_-1000: 8 (0.5%), tests_pri_-950: 2.0 (0.1%), tests_pri_-900: 1.61 (0.1%), tests_pri_-400: 43 (2.4%), check_bayes: 41 (2.3%), b_tokenize: 17 (1.0%), b_tok_get_all: 10 (0.6%), b_comp_prob: 6 (0.3%), b_tok_touch_all: 3.1 (0.2%), b_finish: 0.88 (0.0%), tests_pri_0: 1671 (94.3%), tests_pri_500: 7 (0.4%), 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: 4013 Lines: 87 Casey Schaufler writes: > On 7/15/2015 6:08 PM, Andy Lutomirski wrote: >> On Wed, Jul 15, 2015 at 3:39 PM, Casey Schaufler wrote: >>> On 7/15/2015 2:06 PM, Eric W. Biederman wrote: >>>> Casey Schaufler writes: >>>> 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. >>> A filesystem with Smack labels gets mounted in a namespace. The labels >>> are ignored. Instead, the filesystem defaults (potentially specified as >>> mount options smackfsdef="something", but usually the floor label ("_")) >>> are used, giving the user the ability to read everything and (usually) >>> change nothing. This is both dangerous (unintended read access to files) >>> and pointless (can't make changes). >> I don't get it. >> >> If I mount an unprivileged filesystem, then either the contents were >> put there *by me*, in which case letting me access them are fine, or >> (with Seth's patches and then some) I control the backing store, in >> which case I can do whatever I want regardless of what LSM thinks. >> >> So I don't see the problem. Why would Smack or any other LSM care at >> all, unless it wants to prevent me from mounting the fs in the first >> place? > > First off, I don't cotton to the notion that you should be able > to mount filesystems without privilege. But it seems I'm being > outvoted on that. I suspect that there are cases where it might > be safe, but I can't think of one off the top of my head. There are two fundamental issues mounting filesystems without privielge, by which I actually mean mounting filesystems as the root user in a user namespace. - Are the semantics safe. - Is the extra attack surface a problem. Figuring out how to make semantics safe is what we are talking about. Once we sort out the semantics we can look at the handful of filesystems like fuse where the extra attack surface is not a concern. With that said desktop environments have for a long time been automatically mounting whichever filesystem you place in your computer, so in practice what this is really about is trying to align the kernel with how people use filesystems. I haven't looked closely but I think docker is just about as bad as those desktop environments when it comes to mounting filesystems. > If you do mount a filesystem it needs to behave according to the > rules of the system. I agree. > If you have a security module that uses > attributes on the filesystem you can't ignore them just because > it's "your data". Mandatory access control schemes, including > Smack and SELinux don't give a fig about who you are. It's the > label on the data and the process that matter. If "you" get to > muck the labels up, you've broken the mandatory access control. So there are filesystems like fat and minix that can not store a label. Since it is not possible to store labels securely in filesystems mounted by unprivileged users (at least in the normal sense) the intent would be to treat a filesystem mounted without the privileges of the global root user as a filesystem that does not support xattrs. Treating such a filesystem as a filesystem that does not support xattrs is the only possible way support such a filesystem securely, because as you have said someone who can muck up the labels breaks mandatory access control. Given how non-trivial it is to grasp the nuances of different lsms mandatory access control semantics, I am asking Seth for the first past to simply forbid mounting of filesystems with just user namespace permissions when there is an lsm active. Once we get that far smack may never need to support such systems. 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/