From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Lutomirski Subject: Re: [RFC] capabilities: Ambient capabilities Date: Mon, 30 Mar 2015 07:31:22 -0700 Message-ID: References: <933931146caf5dac58379f50c017bff9f6c47661.1426183417.git.luto@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Christoph Lameter Cc: Jarkko Sakkinen , Andrew Lutomirski , Ted Ts'o , Andrew Morton , "Andrew G. Morgan" , Linux API , Mimi Zohar , Michael Kerrisk , Austin S Hemmelgarn , linux-security-module , Aaron Jones , Serge Hallyn , LKML , Markku Savela , Kees Cook , Jonathan Corbet List-Id: linux-api@vger.kernel.org On Mar 30, 2015 7:55 AM, "Christoph Lameter" wrote: > > On Sat, 14 Mar 2015, Andrew G. Morgan wrote: > > > > > I thought I did. Please implement a lockable secure bit and I will > > Would this suffice? It puts the CAP_SETPCAP limitation back to how it > was in my earlier patch. > I really don't like that variant. CAP_SETPCAP is dangerous and so absurdly powerful that people really shouldn't hand it out. I'll submit a new version this week with the securebits. Sorry for the delay. --Andy > > > Subject: ambient caps: Allow disabling with SETPCAP > > Do not allow setting ambient caps if CAP_SETPCAP is not set. > > Signed-off-by: Christoph Lameter > > Index: linux/security/commoncap.c > =================================================================== > --- linux.orig/security/commoncap.c > +++ linux/security/commoncap.c > @@ -962,6 +962,9 @@ int cap_task_prctl(int option, unsigned > if (((!cap_valid(arg3)) | arg4 | arg5)) > return -EINVAL; > > + if (!ns_capable(current_user_ns(), CAP_SETPCAP)) > + return -EPERM; > + > if (arg2 == PR_CAP_AMBIENT_GET) { > return !!cap_raised(current_cred()->cap_ambient, arg3); > } else if (arg2 != PR_CAP_AMBIENT_RAISE &&