Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1015192ybl; Wed, 21 Aug 2019 08:52:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwWP18Fs94aKjeEYrqzI7sA32E9bwmo3zCdjzfquy76O+og7lHLqb29eBA2S6ZvvJoje7Ah X-Received: by 2002:a62:7996:: with SMTP id u144mr36619525pfc.228.1566402748958; Wed, 21 Aug 2019 08:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566402748; cv=none; d=google.com; s=arc-20160816; b=K44tjHALKTDpNIrQh06A6IgLjaRxCcp8+BfT8m8qd8RrbsMtww+2IAVyZDznk4bOH4 16m5BrMotmMLjs2ae0CYd/QDG3XXVXAzaBo8Op19CJJjDpQeyhC2pswvDmJSt4GoyScN pRs6c3HxbVZGLcSVwGidyqBswP5W+82mWkC409FooIItb5coHjQ+Et/pQ2Tgn5HMxHw1 JNfH1XOGCGTQqGQv6Z+feIFPUbhCvuHEq+d41hCZqeowQFcVcODABfyWYKWeggp+48uL 13L9y10m1umsL2BGIZV22HdsFIWHMpqBecQ4i4gIGbFmSZ71AmlwAdUU1USAOzyrnb33 wVsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject; bh=aU6AJ9nSEof+7rhP40jfOuwUcO31GkOK1RgVchnKRPs=; b=la+tdv6tekG85irHRbeS7ept/DosM0rHB5g9/Xt0sB/7qk4H8ejnweYAd3w0/iRKdJ yvYuxXe4mJ4xcuRHMiuLjEmVxWnlTVz8jxEvg9xve5nf0pqaNMxz3AgEw+C4eLjtRhrH GM14IMENRGaKlahxpyhAB5Z3GJGXszahKOUJXkyBEymZE7Z57z6DHDggFGGrR8jxb1Gk JN5+9OrTT/5Frr3lRYh/uIfdIxkK4J0Ie1hRaXc1ELTLZBGRda4W5mN+/Fedg8UiPvj3 tzSkwgQdvhLewLC3bma1N3kIo976lKtpkL1nox1SRZibenb5BWPX7XM2rhfX8pRjfvrT gLSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v189si14567470pgd.289.2019.08.21.08.52.14; Wed, 21 Aug 2019 08:52:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728507AbfHUPnh (ORCPT + 99 others); Wed, 21 Aug 2019 11:43:37 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:32854 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726513AbfHUPng (ORCPT ); Wed, 21 Aug 2019 11:43:36 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7LFh3tT007868 for ; Wed, 21 Aug 2019 11:43:35 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2uh84rte65-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 21 Aug 2019 11:43:35 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Aug 2019 16:43:32 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 21 Aug 2019 16:43:29 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x7LFhSk936306986 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Aug 2019 15:43:28 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 89B9752050; Wed, 21 Aug 2019 15:43:28 +0000 (GMT) Received: from localhost.localdomain (unknown [9.80.219.114]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2390052054; Wed, 21 Aug 2019 15:43:24 +0000 (GMT) Subject: Re: [GIT PULL] Keys: Set 4 - Key ACLs for 5.3 From: Mimi Zohar To: David Howells Cc: Linus Torvalds , James Morris , keyrings@vger.kernel.org, Netdev , linux-nfs@vger.kernel.org, CIFS , linux-afs@lists.infradead.org, linux-fsdevel , linux-integrity@vger.kernel.org, LSM List , Linux List Kernel Mailing Date: Wed, 21 Aug 2019 11:43:23 -0400 In-Reply-To: <23498.1565962602@warthog.procyon.org.uk> References: <1562814435.4014.11.camel@linux.ibm.com> <28477.1562362239@warthog.procyon.org.uk> <20190710194620.GA83443@gmail.com> <20190710201552.GB83443@gmail.com> <23498.1565962602@warthog.procyon.org.uk> 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-cbid: 19082115-0028-0000-0000-0000039227A6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19082115-0029-0000-0000-000024544FC7 Message-Id: <1566402203.5162.12.camel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-21_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908210163 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2019-08-16 at 14:36 +0100, David Howells wrote: > Mimi Zohar wrote: > > > Sorry for the delay.  An exception is needed for loading builtin keys > > "KEY_ALLOC_BUILT_IN" onto a keyring that is not writable by userspace. > >  The following works, but probably is not how David would handle the > > exception. > > I think the attached is the right way to fix it. > > load_system_certificate_list(), for example, when it creates keys does this: > > key = key_create_or_update(make_key_ref(builtin_trusted_keys, 1), > > marking the keyring as "possessed" in make_key_ref(). This allows the > possessor permits to be used - and that's the *only* way to use them for > internal keyrings like this because you can't link to them and you can't join > them. In addition, as long as additional keys still can't be added or existing keys updated by userspace on the .builtin_trusted_keys, then this is fine. > > David > --- > diff --git a/certs/system_keyring.c b/certs/system_keyring.c > index 57be78b5fdfc..1f8f26f7bb05 100644 > --- a/certs/system_keyring.c > +++ b/certs/system_keyring.c > @@ -99,7 +99,7 @@ static __init int system_trusted_keyring_init(void) > builtin_trusted_keys = > keyring_alloc(".builtin_trusted_keys", > KUIDT_INIT(0), KGIDT_INIT(0), current_cred(), > - &internal_key_acl, KEY_ALLOC_NOT_IN_QUOTA, > + &internal_keyring_acl, KEY_ALLOC_NOT_IN_QUOTA, > NULL, NULL); > if (IS_ERR(builtin_trusted_keys)) > panic("Can't allocate builtin trusted keyring\n"); > diff --git a/security/keys/permission.c b/security/keys/permission.c > index fc84d9ef6239..86efd3eaf083 100644 > --- a/security/keys/permission.c > +++ b/security/keys/permission.c > @@ -47,7 +47,7 @@ struct key_acl internal_keyring_acl = { > .usage = REFCOUNT_INIT(1), > .nr_ace = 2, > .aces = { > - KEY_POSSESSOR_ACE(KEY_ACE_SEARCH), > + KEY_POSSESSOR_ACE(KEY_ACE_SEARCH | KEY_ACE_WRITE), > KEY_OWNER_ACE(KEY_ACE_VIEW | KEY_ACE_READ | KEY_ACE_SEARCH), > } > }; Thanks, David.  The builtin keys are now being loaded. Mimi