From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752845AbdJLP1R (ORCPT ); Thu, 12 Oct 2017 11:27:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33712 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751499AbdJLP1P (ORCPT ); Thu, 12 Oct 2017 11:27:15 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 335E73E2AB Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dhowells@redhat.com 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: <20170927195047.122358-2-ebiggers3@gmail.com> References: <20170927195047.122358-2-ebiggers3@gmail.com> <20170927195047.122358-1-ebiggers3@gmail.com> To: Eric Biggers Cc: dhowells@redhat.com, keyrings@vger.kernel.org, Michael Halcrow , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Biggers , stable@vger.kernel.org Subject: Re: [PATCH v3 1/7] KEYS: don't let add_key() update an uninstantiated key MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22671.1507822027.1@warthog.procyon.org.uk> Date: Thu, 12 Oct 2017 16:27:07 +0100 Message-ID: <22673.1507822027@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 12 Oct 2017 15:27:15 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eric Biggers wrote: > Therefore, change find_key_to_update() to return NULL if the found key > is uninstantiated, so that add_key() replaces the key rather than > instantiating it. This seems to be better than fixing __key_update() to > call __key_instantiate_and_link(), since given all the bugs noted above > as well as that the existing behavior was undocumented and > keyctl_instantiate() is supposed to be used instead, I doubt anyone was > relying on the existing behavior. keyctl_instantiate() can only be called from an upcall. It can't be called in the same context as keyctl_update(). I would be okay with making key_update() wait for completion of construction in this case. David