From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932928AbbIYSEg (ORCPT ); Fri, 25 Sep 2015 14:04:36 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:36783 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932765AbbIYSEe (ORCPT ); Fri, 25 Sep 2015 14:04:34 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Seth Forshee Cc: Alexander Viro , Serge Hallyn , James Morris , "Serge E. Hallyn" , Andy Lutomirski , linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org References: <1443039368-55445-1-git-send-email-seth.forshee@canonical.com> <1443039368-55445-5-git-send-email-seth.forshee@canonical.com> <87fv23o4vs.fsf@x220.int.ebiederm.org> <20150925124924.GB104990@ubuntu-hedt> Date: Fri, 25 Sep 2015 12:57:12 -0500 In-Reply-To: <20150925124924.GB104990@ubuntu-hedt> (Seth Forshee's message of "Fri, 25 Sep 2015 07:49:24 -0500") Message-ID: <87k2reidqf.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX18+toN5NH8IFQrNIGtX0kkszrkpkBsk1Zg= X-SA-Exim-Connect-IP: 67.3.201.231 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 BAYES_20 BODY: Bayes spam probability is 5 to 20% * [score: 0.1270] * -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: ;Seth Forshee X-Spam-Relay-Country: X-Spam-Timing: total 552 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 4.9 (0.9%), b_tie_ro: 3.3 (0.6%), parse: 1.21 (0.2%), extract_message_metadata: 47 (8.5%), get_uri_detail_list: 1.68 (0.3%), tests_pri_-1000: 11 (2.0%), tests_pri_-950: 2.1 (0.4%), tests_pri_-900: 1.69 (0.3%), tests_pri_-400: 53 (9.6%), check_bayes: 51 (9.3%), b_tokenize: 11 (1.9%), b_tok_get_all: 7 (1.3%), b_comp_prob: 3.9 (0.7%), b_tok_touch_all: 2.8 (0.5%), b_finish: 0.92 (0.2%), tests_pri_0: 419 (75.9%), tests_pri_500: 6 (1.1%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v4 4/7] fs: Limit file caps to the user namespace of the super block 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 Seth Forshee writes: > On Thu, Sep 24, 2015 at 04:59:35PM -0500, Eric W. Biederman wrote: >> Seth Forshee writes: >> >> > Capability sets attached to files must be ignored except in the >> > user namespaces where the mounter is privileged, i.e. s_user_ns >> > and its descendants. Otherwise a vector exists for gaining >> > privileges in namespaces where a user is not already privileged. >> > >> > Add a new helper function, in_user_ns(), to test whether a user >> > namespace is the same as or a descendant of another namespace. >> > Use this helper to determine whether a file's capability set >> > should be applied to the caps constructed during exec. >> >> No issues with this but given that we always pass current_user_ns() >> we may want to simplify the users of in_user_ns by renaming it >> current_in_user_ns() and hard codeing current_user_ns(). > > Sure, if that's what you prefer then I'll change it. I took your patch as is. This is a suggestion for a possible incremental improvement. Eric