From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751216AbdGOV1c (ORCPT ); Sat, 15 Jul 2017 17:27:32 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57480 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751190AbdGOV13 (ORCPT ); Sat, 15 Jul 2017 17:27:29 -0400 Subject: Re: [PATCH v2] xattr: Enable security.capability in user namespaces To: "Eric W. Biederman" References: <1499785511-17192-1-git-send-email-stefanb@linux.vnet.ibm.com> <1499785511-17192-2-git-send-email-stefanb@linux.vnet.ibm.com> <87d192si18.fsf@xmission.com> Cc: containers@lists.linux-foundation.org, lkp@01.org, linux-kernel@vger.kernel.org, zohar@linux.vnet.ibm.com, tycho@docker.com, serge@hallyn.com, James.Bottomley@HansenPartnership.com, vgoyal@redhat.com, christian.brauner@mailbox.org, amir73il@gmail.com, linux-security-module@vger.kernel.org, casey@schaufler-ca.com From: Stefan Berger Date: Sat, 15 Jul 2017 17:27:22 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <87d192si18.fsf@xmission.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17071521-0004-0000-0000-00001296A0EC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007370; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00888062; UDB=6.00443452; IPR=6.00668234; BA=6.00005473; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016236; XFM=3.00000015; UTC=2017-07-15 21:27:27 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071521-0005-0000-0000-0000803FABD6 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-15_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707150361 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/14/2017 07:41 PM, Eric W. Biederman wrote: > Stefan Berger <"Stefan Bergerstefanb"@linux.vnet.ibm.com> writes: > >> From: Stefan Berger >> >> This patch enables security.capability in user namespaces but also >> takes a more general approach to enabling extended attributes in user >> namespaces. >> >> The following rules describe the approach using security.foo as a >> 'user namespace enabled' extended attribute: >> >> Reading of extended attributes: >> >> 1a) Reading security.foo from a user namespace will read >> security.foo@uid= of the parent user namespace instead with uid >> being the mapping of root in that parent user namespace. An >> exception is if root is mapped to uid 0 on the host, and in this case >> we will read security.foo directly. >> --> reading security.foo will read security.foo@uid=1000 for uid >> mapping of root to 1000. >> >> 1b) If security.foo@uid= is not available, the security.foo of the >> parent namespace is tried to be read. This procedure is repeated up to >> the init user namespace. This step only applies for reading of extended >> attributes and provides the same behavior as older system where the >> host's extended attributes applied to user namespaces. >> >> 2) All security.foo@uid= with valid uid mapping in the user namespace >> can be read. The uid within the user namespace will be mapped to the >> corresponding uid on the host and that uid will be used in the name of >> the extended attribute. >> -> reading security.foo@uid=1 will read security.foo@uid=1001 for uid >> mapping of root to 1000, size of at least 2. >> >> All security.foo@uid= can be read (by root) on the host with values >> of also being subject to checking for valid mappings. >> >> 3) No other security.foo* can be read. >> >> The same rules for reading apply to writing and removing of user >> namespace enabled extended attributes. >> >> When listing extended attributes of a file, only those are presented >> to the user namespace that have a valid mapping. Besides that, names >> of the extended attributes are adjusted to represent the mapping. >> This means that if root is mapped to uid 1000 on the host, the >> security.foo@uid=1000 will be listed as security.foo in the user >> namespace, security.foo@uid=1001 becomes security.foo@uid=1 and so on. >> >> Signed-off-by: Stefan Berger >> Signed-off-by: Serge Hallyn >> Reviewed-by: Serge Hallyn >> --- >> fs/xattr.c | 509 +++++++++++++++++++++++++++++++++++++++++++++-- >> security/commoncap.c | 36 +++- >> security/selinux/hooks.c | 9 +- >> 3 files changed, 523 insertions(+), 31 deletions(-) > I am just going to quickly and publicly point out that as designed this > patch breaks evm inode metadata signing. As evm_config_xattrnames is not > updated. > > While not completely insurmountable that seems like a strong limitation of > this design. EVM could be converted to get the list of xattrs and prefix-compare it against the evm_config_xattrnames to do what it does now. Stefan From mboxrd@z Thu Jan 1 00:00:00 1970 From: stefanb@linux.vnet.ibm.com (Stefan Berger) Date: Sat, 15 Jul 2017 17:27:22 -0400 Subject: [PATCH v2] xattr: Enable security.capability in user namespaces In-Reply-To: <87d192si18.fsf@xmission.com> References: <1499785511-17192-1-git-send-email-stefanb@linux.vnet.ibm.com> <1499785511-17192-2-git-send-email-stefanb@linux.vnet.ibm.com> <87d192si18.fsf@xmission.com> Message-ID: To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org On 07/14/2017 07:41 PM, Eric W. Biederman wrote: > Stefan Berger <"Stefan Bergerstefanb"@linux.vnet.ibm.com> writes: > >> From: Stefan Berger >> >> This patch enables security.capability in user namespaces but also >> takes a more general approach to enabling extended attributes in user >> namespaces. >> >> The following rules describe the approach using security.foo as a >> 'user namespace enabled' extended attribute: >> >> Reading of extended attributes: >> >> 1a) Reading security.foo from a user namespace will read >> security.foo at uid= of the parent user namespace instead with uid >> being the mapping of root in that parent user namespace. An >> exception is if root is mapped to uid 0 on the host, and in this case >> we will read security.foo directly. >> --> reading security.foo will read security.foo at uid=1000 for uid >> mapping of root to 1000. >> >> 1b) If security.foo at uid= is not available, the security.foo of the >> parent namespace is tried to be read. This procedure is repeated up to >> the init user namespace. This step only applies for reading of extended >> attributes and provides the same behavior as older system where the >> host's extended attributes applied to user namespaces. >> >> 2) All security.foo at uid= with valid uid mapping in the user namespace >> can be read. The uid within the user namespace will be mapped to the >> corresponding uid on the host and that uid will be used in the name of >> the extended attribute. >> -> reading security.foo at uid=1 will read security.foo at uid=1001 for uid >> mapping of root to 1000, size of at least 2. >> >> All security.foo at uid= can be read (by root) on the host with values >> of also being subject to checking for valid mappings. >> >> 3) No other security.foo* can be read. >> >> The same rules for reading apply to writing and removing of user >> namespace enabled extended attributes. >> >> When listing extended attributes of a file, only those are presented >> to the user namespace that have a valid mapping. Besides that, names >> of the extended attributes are adjusted to represent the mapping. >> This means that if root is mapped to uid 1000 on the host, the >> security.foo at uid=1000 will be listed as security.foo in the user >> namespace, security.foo at uid=1001 becomes security.foo at uid=1 and so on. >> >> Signed-off-by: Stefan Berger >> Signed-off-by: Serge Hallyn >> Reviewed-by: Serge Hallyn >> --- >> fs/xattr.c | 509 +++++++++++++++++++++++++++++++++++++++++++++-- >> security/commoncap.c | 36 +++- >> security/selinux/hooks.c | 9 +- >> 3 files changed, 523 insertions(+), 31 deletions(-) > I am just going to quickly and publicly point out that as designed this > patch breaks evm inode metadata signing. As evm_config_xattrnames is not > updated. > > While not completely insurmountable that seems like a strong limitation of > this design. EVM could be converted to get the list of xattrs and prefix-compare it against the evm_config_xattrnames to do what it does now. Stefan -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============1438474982040793157==" MIME-Version: 1.0 From: Stefan Berger To: lkp@lists.01.org Subject: Re: [PATCH v2] xattr: Enable security.capability in user namespaces Date: Sat, 15 Jul 2017 17:27:22 -0400 Message-ID: In-Reply-To: <87d192si18.fsf@xmission.com> List-Id: --===============1438474982040793157== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On 07/14/2017 07:41 PM, Eric W. Biederman wrote: > Stefan Berger <"Stefan Bergerstefanb"@linux.vnet.ibm.com> writes: > >> From: Stefan Berger >> >> This patch enables security.capability in user namespaces but also >> takes a more general approach to enabling extended attributes in user >> namespaces. >> >> The following rules describe the approach using security.foo as a >> 'user namespace enabled' extended attribute: >> >> Reading of extended attributes: >> >> 1a) Reading security.foo from a user namespace will read >> security.foo(a)uid=3D of the parent user namespace instead wit= h uid >> being the mapping of root in that parent user namespace. An >> exception is if root is mapped to uid 0 on the host, and in this ca= se >> we will read security.foo directly. >> --> reading security.foo will read security.foo(a)uid=3D1000 for uid >> mapping of root to 1000. >> >> 1b) If security.foo(a)uid=3D is not available, the security.foo of = the >> parent namespace is tried to be read. This procedure is repeated up= to >> the init user namespace. This step only applies for reading of exte= nded >> attributes and provides the same behavior as older system where the >> host's extended attributes applied to user namespaces. >> >> 2) All security.foo(a)uid=3D with valid uid mapping in the user nam= espace >> can be read. The uid within the user namespace will be mapped to the >> corresponding uid on the host and that uid will be used in the name = of >> the extended attribute. >> -> reading security.foo(a)uid=3D1 will read security.foo(a)uid=3D100= 1 for uid >> mapping of root to 1000, size of at least 2. >> >> All security.foo(a)uid=3D can be read (by root) on the host wit= h values >> of also being subject to checking for valid mappings. >> >> 3) No other security.foo* can be read. >> >> The same rules for reading apply to writing and removing of user >> namespace enabled extended attributes. >> >> When listing extended attributes of a file, only those are presented >> to the user namespace that have a valid mapping. Besides that, names >> of the extended attributes are adjusted to represent the mapping. >> This means that if root is mapped to uid 1000 on the host, the >> security.foo(a)uid=3D1000 will be listed as security.foo in the user >> namespace, security.foo(a)uid=3D1001 becomes security.foo(a)uid=3D1 and = so on. >> >> Signed-off-by: Stefan Berger >> Signed-off-by: Serge Hallyn >> Reviewed-by: Serge Hallyn >> --- >> fs/xattr.c | 509 +++++++++++++++++++++++++++++++++++++++= ++++++-- >> security/commoncap.c | 36 +++- >> security/selinux/hooks.c | 9 +- >> 3 files changed, 523 insertions(+), 31 deletions(-) > I am just going to quickly and publicly point out that as designed this > patch breaks evm inode metadata signing. As evm_config_xattrnames is not > updated. > > While not completely insurmountable that seems like a strong limitation of > this design. EVM could be converted to get the list of xattrs and prefix-compare it = against the evm_config_xattrnames to do what it does now. Stefan --===============1438474982040793157==--