From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mimi Zohar Date: Fri, 15 May 2020 19:50:56 +0000 Subject: Re: [PATCH v9 0/8] TPM 2.0 trusted keys with attached policy Message-Id: <1589572256.5111.60.camel@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit List-Id: References: <20200507231147.27025-1-James.Bottomley@HansenPartnership.com> <23639de13874c00e6bb2b816b4db0b586c9a074c.camel@linux.intel.com> <483c4f1af7be41c8d091b11d4484b606ebd319b7.camel@linux.intel.com> <1589514263.5759.25.camel@HansenPartnership.com> <20200515084702.GA3404@linux.intel.com> <20200515191758.ieojyk5xhsx2hzzd@cantor> <1589571278.3653.22.camel@HansenPartnership.com> In-Reply-To: <1589571278.3653.22.camel@HansenPartnership.com> To: James Bottomley , Jerry Snitselaar , Jarkko Sakkinen Cc: linux-integrity@vger.kernel.org, David Woodhouse , keyrings@vger.kernel.org, David Howells On Fri, 2020-05-15 at 12:34 -0700, James Bottomley wrote: > On Fri, 2020-05-15 at 12:17 -0700, Jerry Snitselaar wrote: > > On Fri May 15 20, Jarkko Sakkinen wrote: > > > On Thu, May 14, 2020 at 08:44:23PM -0700, James Bottomley wrote: > > > > On Fri, 2020-05-15 at 05:22 +0300, Jarkko Sakkinen wrote: > [...] > > > > > sudo ./keyctl-smoke.sh > > > > > 566201053 (0x80000000) > > > > > keyctl_read_alloc: Permission denied > > > > I get keyctl_read_alloc -EPERM when I 'sudo su' and try to play with > > keyctl print. > > If I 'sudo su -' and then try it works as expected. Also works for > > normal user. > > OK, I confirm on debian as well. If I create a key as real root and > then try to sudo su keyctl pipe it as an ordinary user, I get EPERM. > > It smells like a cockup in real vs effective permissions somewhere in > the keyctl handler. Doing "sudo su -" has always been required.  "su -" must set some environment variables.  This isn't a problem for dracut as it is running as root. Mimi From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87046C433E0 for ; Fri, 15 May 2020 19:51:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68D7920727 for ; Fri, 15 May 2020 19:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726204AbgEOTvQ (ORCPT ); Fri, 15 May 2020 15:51:16 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:32856 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbgEOTvP (ORCPT ); Fri, 15 May 2020 15:51:15 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04FJWadS032410; Fri, 15 May 2020 15:51:03 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 311rd77jky-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 May 2020 15:51:03 -0400 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 04FJWtOC033348; Fri, 15 May 2020 15:51:02 -0400 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 311rd77jkg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 May 2020 15:51:02 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 04FJoOhN023160; Fri, 15 May 2020 19:51:00 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma05fra.de.ibm.com with ESMTP id 3100ub2gth-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 May 2020 19:51:00 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 04FJowh535389588 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 May 2020 19:50:58 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1C9A9A404D; Fri, 15 May 2020 19:50:58 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 32447A4057; Fri, 15 May 2020 19:50:57 +0000 (GMT) Received: from localhost.localdomain (unknown [9.85.153.130]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 15 May 2020 19:50:57 +0000 (GMT) Message-ID: <1589572256.5111.60.camel@linux.ibm.com> Subject: Re: [PATCH v9 0/8] TPM 2.0 trusted keys with attached policy From: Mimi Zohar To: James Bottomley , Jerry Snitselaar , Jarkko Sakkinen Cc: linux-integrity@vger.kernel.org, David Woodhouse , keyrings@vger.kernel.org, David Howells Date: Fri, 15 May 2020 15:50:56 -0400 In-Reply-To: <1589571278.3653.22.camel@HansenPartnership.com> References: <20200507231147.27025-1-James.Bottomley@HansenPartnership.com> <23639de13874c00e6bb2b816b4db0b586c9a074c.camel@linux.intel.com> <483c4f1af7be41c8d091b11d4484b606ebd319b7.camel@linux.intel.com> <1589514263.5759.25.camel@HansenPartnership.com> <20200515084702.GA3404@linux.intel.com> <20200515191758.ieojyk5xhsx2hzzd@cantor> <1589571278.3653.22.camel@HansenPartnership.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.676 definitions=2020-05-15_07:2020-05-15,2020-05-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 spamscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 clxscore=1011 phishscore=0 impostorscore=0 mlxlogscore=921 adultscore=0 cotscore=-2147483648 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005150161 Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On Fri, 2020-05-15 at 12:34 -0700, James Bottomley wrote: > On Fri, 2020-05-15 at 12:17 -0700, Jerry Snitselaar wrote: > > On Fri May 15 20, Jarkko Sakkinen wrote: > > > On Thu, May 14, 2020 at 08:44:23PM -0700, James Bottomley wrote: > > > > On Fri, 2020-05-15 at 05:22 +0300, Jarkko Sakkinen wrote: > [...] > > > > > sudo ./keyctl-smoke.sh > > > > > 566201053 (0x80000000) > > > > > keyctl_read_alloc: Permission denied > > > > I get keyctl_read_alloc -EPERM when I 'sudo su' and try to play with > > keyctl print. > > If I 'sudo su -' and then try it works as expected. Also works for > > normal user. > > OK, I confirm on debian as well. If I create a key as real root and > then try to sudo su keyctl pipe it as an ordinary user, I get EPERM. > > It smells like a cockup in real vs effective permissions somewhere in > the keyctl handler. Doing "sudo su -" has always been required.  "su -" must set some environment variables.  This isn't a problem for dracut as it is running as root. Mimi