Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966701AbbBDPuJ (ORCPT ); Wed, 4 Feb 2015 10:50:09 -0500 Received: from resqmta-ch2-10v.sys.comcast.net ([69.252.207.42]:40573 "EHLO resqmta-ch2-10v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965437AbbBDPuG (ORCPT ); Wed, 4 Feb 2015 10:50:06 -0500 Date: Wed, 4 Feb 2015 09:50:04 -0600 (CST) From: Christoph Lameter X-X-Sender: cl@gentwo.org To: "Andrew G. Morgan" cc: "Serge E. Hallyn" , Serge Hallyn , Serge Hallyn , Andy Lutomirski , Jonathan Corbet , Aaron Jones , "Ted Ts'o" , linux-security-module@vger.kernel.org, lkml , akpm@linuxfoundation.org Subject: Re: [capabilities] Allow normal inheritance for a configurable set of capabilities In-Reply-To: Message-ID: References: <20150202171257.GD24351@ubuntumail> <20150203155544.GE2923@mail.hallyn.com> <20150203172653.GB4748@mail.hallyn.com> Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2022 Lines: 47 On Wed, 4 Feb 2015, Andrew G. Morgan wrote: > I'm not generally in favor of this. Mostly because this seems to be a > mini-root kind of inheritance that propagates privilege to binaries > that aren't prepared for privilege. I don't really buy the mmap code > concern because the model as it stands says that you trust the binary > (and all of the various ways it was programmed to execute code) with > specific privileges. If the binary mmap's some code (PAM modules come > to mind) then that is part of what it was programmed to/allowed to do. > > That being said, if you really really want this kind of thing, then > make it a single secure bit (with another lock on/off bit) which, when > set, makes: fI default to X. > > pP' = (X & fP) | (pI & fI) > > That way the per-process bounding set still works as advertised and > you don't need to worry about the existing semantics being violated. Ok but then also fI needs to be set to X so that the binary f invokes can also inherit. So if we copy the inheritable flags to fI then we wont be needing the bounding set anymore. The changes to brpm_caps_from_vfs_cap would then be only the following? (substitute capable(CAP_INHERIT_BY_DEFAULT through any other means like PRCTL if wanted). Index: linux/security/commoncap.c =================================================================== --- linux.orig/security/commoncap.c 2015-02-04 09:44:25.000000000 -0600 +++ linux/security/commoncap.c 2015-02-04 09:45:59.381572756 -0600 @@ -350,6 +350,9 @@ static inline int bprm_caps_from_vfs_cap __u32 permitted = caps->permitted.cap[i]; __u32 inheritable = caps->inheritable.cap[i]; + if (capable(CAP_INHERIT_BY_DEFAULT) + new->cap_inheritable.cap[i] = inheritable; + /* * pP' = (X & fP) | (pI & fI) */ -- 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/