From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932431AbcECGFX (ORCPT ); Tue, 3 May 2016 02:05:23 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:49513 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750819AbcECGFV (ORCPT ); Tue, 3 May 2016 02:05:21 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: "Serge E. Hallyn" Cc: "Andrew G. Morgan" , Kees Cook , Jann Horn , Michael Kerrisk-manpages , "Serge E. Hallyn" , Linux API , Andy Lutomirski , Linux Containers , LKML References: <1461345993-17526-1-git-send-email-serge.hallyn@ubuntu.com> <1461345993-17526-2-git-send-email-serge.hallyn@ubuntu.com> <20160426222627.GA19307@mail.hallyn.com> <20160502035452.GA31837@mail.hallyn.com> <87h9egp2oq.fsf@x220.int.ebiederm.org> <20160503051921.GA31551@mail.hallyn.com> Date: Tue, 03 May 2016 00:54:40 -0500 In-Reply-To: <20160503051921.GA31551@mail.hallyn.com> (Serge E. Hallyn's message of "Tue, 3 May 2016 00:19:21 -0500") Message-ID: <87bn4nhejj.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: U2FsdGVkX180707DKsEG2JRRHPUt4acfpgadqGyz5L8= X-SA-Exim-Connect-IP: 97.119.108.118 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 XMNoVowels Alpha-numberic number with no vowels * 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.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4994] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 1.0 T_XMDrugObfuBody_04 obfuscated drug references * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;"Serge E. Hallyn" X-Spam-Relay-Country: X-Spam-Timing: total 256 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 4.2 (1.7%), b_tie_ro: 3.0 (1.2%), parse: 0.98 (0.4%), extract_message_metadata: 14 (5.4%), get_uri_detail_list: 2.3 (0.9%), tests_pri_-1000: 5 (2.0%), tests_pri_-950: 1.22 (0.5%), tests_pri_-900: 1.02 (0.4%), tests_pri_-400: 22 (8.7%), check_bayes: 21 (8.2%), b_tokenize: 6 (2.3%), b_tok_get_all: 7 (2.9%), b_comp_prob: 2.2 (0.9%), b_tok_touch_all: 3.1 (1.2%), b_finish: 0.79 (0.3%), tests_pri_0: 198 (77.4%), check_dkim_signature: 0.52 (0.2%), check_dkim_adsp: 3.2 (1.2%), tests_pri_500: 6 (2.2%), poll_dns_idle: 0.37 (0.1%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 1/1] simplified security.nscapability xattr 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 "Serge E. Hallyn" writes: > Quoting Andrew G. Morgan (morgan@kernel.org): >> >> I guess I'm confused how we have strayed so far that this isn't an obvious >> requirement. Uid=0 as being the root of privilege was the basic problem >> that capabilities were designed to change. > > The task executing the file can be any uid mapped into the namespace. The > file only has to be owned by the root of the user_ns. Which I agree is > unfortunate. We can work around it by putting the root uid into the xattr > itself (which still isn't orthogonal but allows the file to at least by > owned by non-root), but the problem then is that a task needs to know its > global root k_uid just to write the xattr. The root kuid is just make_kuids(user_ns, 0) so it is easy to find. It might be a hair better to use the userns->owner instead of the root uid. That would allow user namespaces without a mapped root to still use file capabilities. >> Uid is an acl concept. Capabilities are supposed to be independent of that. >> >> If we want to support NS file capabilities I would look at replacing the >> xattr syscall with a dedicated file capabilities modification syscall. Then > > That was one ofthe possibilities I'd mentioned in my earlier proposal, > fwiw. The problem is if we want tar to still work unmodified then > simple xattr operations still have to work. > > Maybe there's workable semantics there though. Worth thinking about. If the problem is compatibilty please look at posix_acl_fix_xattr_from_user. With something similar for the security.capability attribute we can perform whatever transformation makes sense. I admit adding 4 bytes is a bit of a pain in that context but not a big one. Eric