From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752974AbbC3MzO (ORCPT ); Mon, 30 Mar 2015 08:55:14 -0400 Received: from resqmta-ch2-01v.sys.comcast.net ([69.252.207.33]:49522 "EHLO resqmta-ch2-01v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752709AbbC3MzH (ORCPT ); Mon, 30 Mar 2015 08:55:07 -0400 Date: Mon, 30 Mar 2015 07:55:04 -0500 (CDT) From: Christoph Lameter X-X-Sender: cl@gentwo.org To: "Andrew G. Morgan" cc: Andy Lutomirski , Jarkko Sakkinen , "Ted Ts'o" , Andrew Lutomirski , Andrew Morton , Michael Kerrisk , Mimi Zohar , Linux API , Austin S Hemmelgarn , linux-security-module , Aaron Jones , LKML , Serge Hallyn , Markku Savela , Kees Cook , Jonathan Corbet Subject: Re: [RFC] capabilities: Ambient capabilities In-Reply-To: Message-ID: References: <933931146caf5dac58379f50c017bff9f6c47661.1426183417.git.luto@kernel.org> Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 &&