Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4138251ybg; Fri, 25 Oct 2019 13:57:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqySCQFzJGQlswkHLdbJnLM1+au3c0Y31O9vSG8NYHTI4N5wYzXIkSaiqWq3saJFvsQY0U+S X-Received: by 2002:a17:906:6d45:: with SMTP id a5mr5325065ejt.218.1572037037633; Fri, 25 Oct 2019 13:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572037037; cv=none; d=google.com; s=arc-20160816; b=KpOm5eiHB9hRLIyYkn1Dvk9bZTyeke+JpzHArbfJ6KO86HuaoWe0bVqKjgnezDQqgf QuQr6INCQjNGKwQCVFehSm8APl6kuXRDaq+vPGPiNHaAlPSGEIacBHW2P05f0vwsE5o4 bD/6CBjHcgeitFFjLMxBj2j0xHtjynDkm2YfK+/D83dNVWuPtev/HJJpI/SzdTRpvB2P 0pfF9+pLzEQryZLbs5YEIvf1ln5Rz9AXHSwmRKYP3gvenQdL+4hmh7gPuH8RAFQavEFR Lh8pgkbpIzHTYxuVmEntyHhlJsuSomofzIOPzsTf0UZMopAALmsWVLVI4oGqn/YMbGIv Ss0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature:dkim-filter; bh=arffu6CtqVuIvQ0iJb4yQV3sPO18YA6ZcJjsgBLt/xQ=; b=nVmex+yxSwrt2cE2Y27IDT10KZAiGtIJDLK7HDnZpRyZfTKGr6rK5+eS/ShCyKvIpq 6Qoan8AWHDpsd5SqMRCw1Z+Z0wZosob4cHZ7mfX9FKvf/oCAp1orxLT7M1uSJmB0GS3c SOqYUBF9GOxdlOZrCAwjAjTkDx+XS+oTIc0KEh0WjrYt/PklVuyCEO5wmG1BlQdGOw1T +sXYFmqZGYSxwnJ5ZYzT90iV6pK51vT15ZJSZLuQ4JPmpKU4qrVyI/ru1F5JSlzNdJ60 cSh2MqhvtV8LXr4bWHO9P4CfYawk+QqizC68ZJonkxJJ9AdxM3EZkcX6bOLqnq9q3LvS X91Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=lD93IP13; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d13si1821523ejj.317.2019.10.25.13.56.54; Fri, 25 Oct 2019 13:57:17 -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; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=lD93IP13; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727617AbfJYTt2 (ORCPT + 99 others); Fri, 25 Oct 2019 15:49:28 -0400 Received: from linux.microsoft.com ([13.77.154.182]:38732 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726263AbfJYTt2 (ORCPT ); Fri, 25 Oct 2019 15:49:28 -0400 Received: from [10.137.112.111] (unknown [131.107.147.111]) by linux.microsoft.com (Postfix) with ESMTPSA id 632C62010AC9; Fri, 25 Oct 2019 12:49:27 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 632C62010AC9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1572032967; bh=arffu6CtqVuIvQ0iJb4yQV3sPO18YA6ZcJjsgBLt/xQ=; h=Subject:To:References:From:Date:In-Reply-To:From; b=lD93IP13AyAM2AwIGQvUum25fkCiBf3v7KXinxUlkR4XjpFDt5L83C2dKGYY3/tiu Hrn2jhYlP4712hBMEMtZ9zx7eNeKe56E8ME8t/sv7Y6J78os4oUe4F6I4GeL+LtQi6 QENmDTLIJ9GIhTP8aIuKaFddenhSXQtN7EiMFd+g= Subject: Re: [PATCH v2 1/4] KEYS: Defined an ima hook for measuring keys on key create or update To: Mimi Zohar , dhowells@redhat.com, casey@schaufler-ca.com, sashal@kernel.org, jamorris@linux.microsoft.com, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org References: <20191023233950.22072-1-nramas@linux.microsoft.com> <20191023233950.22072-2-nramas@linux.microsoft.com> <1572032428.4532.72.camel@linux.ibm.com> From: Lakshmi Ramasubramanian Message-ID: <715d35ba-a102-3524-77a8-70a784628b46@linux.microsoft.com> Date: Fri, 25 Oct 2019 12:49:45 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <1572032428.4532.72.camel@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/25/2019 12:40 PM, Mimi Zohar wrote: > On Wed, 2019-10-23 at 16:39 -0700, Lakshmi Ramasubramanian wrote: >> Defined an ima hook to measure keys created or updated in the system. > > "IMA" is an anacronym.  Unless it is a part of a function name, it > should be capitalized. Will fix that. > > Before describing "what" you're doing, describe the problem.  For > example, "The asymmetric keys used for verifying file signatures or > certificates are currently not included in the IMA measurement list. >  This patch defines a new IMA hook named ima_key_create_or_update() to > measure keys." Agree - will update. >> + >> + if (!ima_initialized) >> + return; > > There's no reason to define a new variable to determine if IMA is > initialized.  Use ima_policy_flag. Will change it. >  Like process_measurements, the test should be in process_buffer_measurement(), not here. Currently, queuing of requests when IMA is not initialized is done for keys only. Moving that check inside process_buffer_measurement would mean handling queuing for all buffer measurements. Can that be done as a separate patch set and not in this one? >> @@ -936,6 +937,9 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref, >> goto error_link_end; >> } >> >> + /* let the ima module know about the created key. */ >> + ima_post_key_create_or_update(keyring, key, flags, true); >> + >> key_ref = make_key_ref(key, is_key_possessed(keyring_ref)); > > This patch defines the new IMA hook.  This call and the subsequent one > below can be defined in a separate patch.  The subject line of that > patch would be "keys: Add ima_key_create_or_update call to measure > keys". > > Mimi Agree - will change it. thanks, -lakshmi