Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756511AbbGQAsb (ORCPT ); Thu, 16 Jul 2015 20:48:31 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:55741 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756032AbbGQAs3 (ORCPT ); Thu, 16 Jul 2015 20:48:29 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Dave Chinner Cc: Casey Schaufler , 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> <87fv4owvxv.fsf@x220.int.ebiederm.org> <20150717000914.GO7943@dastard> Date: Thu, 16 Jul 2015 19:42:03 -0500 In-Reply-To: <20150717000914.GO7943@dastard> (Dave Chinner's message of "Fri, 17 Jul 2015 10:09:14 +1000") Message-ID: <87380nobs4.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: U2FsdGVkX18fGWPPl9rToT1TnIO1DZ3ry2ok0EaIjVY= 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 * 1.5 XMNoVowels Alpha-numberic number with no vowels * 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.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: **;Dave Chinner X-Spam-Relay-Country: X-Spam-Timing: total 808 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.8 (0.5%), b_tie_ro: 2.7 (0.3%), parse: 1.42 (0.2%), extract_message_metadata: 32 (4.0%), get_uri_detail_list: 4.9 (0.6%), tests_pri_-1000: 11 (1.4%), tests_pri_-950: 1.95 (0.2%), tests_pri_-900: 1.67 (0.2%), tests_pri_-400: 48 (6.0%), check_bayes: 46 (5.7%), b_tokenize: 18 (2.2%), b_tok_get_all: 12 (1.5%), b_comp_prob: 8 (0.9%), b_tok_touch_all: 3.4 (0.4%), b_finish: 0.87 (0.1%), tests_pri_0: 696 (86.1%), tests_pri_500: 6 (0.8%), 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 in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4014 Lines: 88 Dave Chinner writes: > On Wed, Jul 15, 2015 at 11:47:08PM -0500, Eric W. Biederman wrote: >> Casey Schaufler writes: >> > On 7/15/2015 6:08 PM, Andy Lutomirski wrote: >> >> 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. > > I think the attack surface this exposes is the biggest problem > facing this proposal. I completely agree. >> 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. > > The key difference is that desktops only do this when you physically > plug in a device. With unprivileged mounts, a hostile attacker > doesn't need physical access to the machine to exploit lurking > kernel filesystem bugs. i.e. they can just use loopback mounts, and > they can keep mounting corrupted images until they find something > that works. Yep. That magnifies the problem quite a bit. > User namespaces are supposed to provide trust separation. The > kernel filesystems simply aren't hardened against unprivileged > attacks from below - there is a trust relationship between root and > the filesystem in that they are the only things that can write to > the disk. Mounts from within a userns destroys this relationship as > the userns root, by definition, is not a trusted actor. I talked to Ted Tso a while back and ext4 is at least in principle already hardened against that kind of attack. I am not certain I believe it, but if it is true I think it is fantastic. At this point any setting of the FS_USER_MOUNT flag I figure needs to go through the filesystem maintainers tree and they need to be aware of and agree to deal with the attack from below issue. The one filesystem I truly expect we can make work is fuse. fuse has been designed to deal with some variation of the attack from below issue since day one. We looked at what the patches to fuse would look like with the current state of the vfs and it was not pretty. We very much need to sort through as much as possible at the vfs layer, and in generic code. Allow everyone to see what is going on and how it works before preceeding forward with enabling any filesystems. I truly hope we can find a small set of block device filesystems that we can harden from attack below. That would allow linux to have serious defenses against evil usb stick attacks. I think that is going to take a lot of careful coding, testing and validation and advancing the state of the art to get there. 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/