From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756028AbbCFSxb (ORCPT ); Fri, 6 Mar 2015 13:53:31 -0500 Received: from resqmta-ch2-07v.sys.comcast.net ([69.252.207.39]:43886 "EHLO resqmta-ch2-07v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754828AbbCFSx3 (ORCPT ); Fri, 6 Mar 2015 13:53:29 -0500 Date: Fri, 6 Mar 2015 12:53:26 -0600 (CST) From: Christoph Lameter X-X-Sender: cl@gentwo.org To: "Serge E. Hallyn" cc: Serge Hallyn , Andy Lutomirski , Jonathan Corbet , Aaron Jones , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linuxfoundation.org, "Andrew G. Morgan" , Mimi Zohar , Austin S Hemmelgarn , Markku Savela , Jarkko Sakkinen , linux-api@vger.kernel.org, Michael Kerrisk Subject: Re: [PATCH] capabilities: Ambient capability set V2 In-Reply-To: <20150306163443.GA28386@mail.hallyn.com> Message-ID: References: <20150301233359.GA22196@mail.hallyn.com> <20150305171326.GA14998@mail.hallyn.com> <20150306163443.GA28386@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 On Fri, 6 Mar 2015, Serge E. Hallyn wrote: > Sorry, something about that patch-patch didn't make sense to me, but I > need to look more closely. My objection was that you were able to get the > pA capabilities into pP without them being in your pI. Your proposed > change didn't seem like it would fix that. Just tried to fix that. Could it be that cap_inherited is never set even for a binary that has christoph@fujitsu-haswell:~$ getcap ambient_test ambient_test = cap_setpcap,cap_net_admin,cap_net_raw,cap_sys_nice+eip I added some printks and it seems that current_cred()->cap_inherited is not set when running ambient_test. Index: linux/security/commoncap.c =================================================================== --- linux.orig/security/commoncap.c 2015-03-06 11:05:10.802218196 -0600 +++ linux/security/commoncap.c 2015-03-06 12:50:38.424330679 -0600 @@ -456,6 +456,10 @@ static int get_file_caps(struct linux_bi kernel_cap_t relevant_ambient = cap_intersect( current_cred()->cap_ambient, current_cred()->cap_inheritable); + printk("task->comm %s: Amb=%x Inh=%x relevant=%x\n", + current->comm, current_cred()->cap_ambient.cap[0], + current_cred()->cap_inheritable.cap[0], + relevant_ambient.cap[0]); rc = 0; if (!cap_isclear(relevant_ambient)) { /* Mar 6 12:42:18 fujitsu-haswell kernel: [ 284.715051] task->comm ambient_test: Amb=803000 Inh=0 relevant=0