From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755974AbcB2Ptq (ORCPT ); Mon, 29 Feb 2016 10:49:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45375 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751201AbcB2Ptn convert rfc822-to-8bit (ORCPT ); Mon, 29 Feb 2016 10:49:43 -0500 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <1454932757.2648.143.camel@linux.vnet.ibm.com> References: <1454932757.2648.143.camel@linux.vnet.ibm.com> <20160119113026.23238.4498.stgit@warthog.procyon.org.uk> <20160119113118.23238.44239.stgit@warthog.procyon.org.uk> To: Mimi Zohar Cc: dhowells@redhat.com, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, petkan@mip-labs.com, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 07/20] KEYS: Add a facility to restrict new links into a keyring [ver #2] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30189.1456760980.1@warthog.procyon.org.uk> Content-Transfer-Encoding: 8BIT Date: Mon, 29 Feb 2016 15:49:40 +0000 Message-ID: <30190.1456760980@warthog.procyon.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mimi Zohar wrote: > > + If restrict_link not NULL, it should point to a function will be called to > > + vet all attempts to link keys into the keyring, though this can be > > + overridden by passing KEY_ALLOC_BYPASS_RESTRICTION to > > + key_create_or_update(). > > Please fix the first part of the sentence. Maybe add an example of > when it is appropriate to bypass the restriction - (eg. loading the > builtin keys). Okay: If restrict_link not NULL, it should point to a function that will be called each time an attempt is made to link a key into the new keyring. This function is called to check whether a key may be added into the keying or not. Callers of key_create_or_update() within the kernel can pass KEY_ALLOC_BYPASS_RESTRICTION to suppress the check. An example of using this is to manage rings of cryptographic keys that are set up when the kernel boots where userspace is also permitted to add keys - provided they can be verified by a key the kernel already has. When called, the restriction function will be passed the keyring being added to, the key flags value and the type and payload of the key being added. Note that when a new key is being created, this is called between payload preparsing and actual key creation. The function should return 0 to allow the link or an error to reject it. David