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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL 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 3A1DFCA9EC0 for ; Mon, 28 Oct 2019 14:58:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0CD7421783 for ; Mon, 28 Oct 2019 14:58:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="j0UFvLFA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729154AbfJ1O6i (ORCPT ); Mon, 28 Oct 2019 10:58:38 -0400 Received: from linux.microsoft.com ([13.77.154.182]:42786 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726563AbfJ1O6h (ORCPT ); Mon, 28 Oct 2019 10:58:37 -0400 Received: from [10.137.112.108] (unknown [131.107.174.108]) by linux.microsoft.com (Postfix) with ESMTPSA id AD8EF2010AC5; Mon, 28 Oct 2019 07:58:36 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AD8EF2010AC5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1572274716; bh=+4i7snc8+CJH6rwfZpPIV08+c2Slr7iBUhUCuWfrlls=; h=Subject:To:References:From:Date:In-Reply-To:From; b=j0UFvLFAwzPt56V4SalGwYBFPyo5AY8x+FDt/QbWoI7weuCwz94pbxHS2dxcBywsO /Au8gNVv1GfwxnunbQq+3l5z+IcOX8CI0/1qn/lWU1D3WD4s1o3bl2iSeln9CRJSRq DIjRAtjUzDkwRDz3GalJJ9ckMbiYvrkixtFgKYFE= 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> <1572187644.4532.211.camel@linux.ibm.com> From: Lakshmi Ramasubramanian Message-ID: <1d7730ff-9847-c6be-4f4f-8cf1e90a71f2@linux.microsoft.com> Date: Mon, 28 Oct 2019 07:58:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <1572187644.4532.211.camel@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On 10/27/19 7:47 AM, Mimi Zohar wrote: >>> There's no reason to define a new variable to determine if IMA is >>> initialized.  Use ima_policy_flag. >> >> Please correct me if I am wrong - >> >> ima_policy_flag will be set to 0 if IMA is not yet initialized >> OR >> IMA is initialized, but ima_policy_flag could be still set to 0 (say, >> due to the configured policy). >> >> In the latter case the measurement request should be a NOP immediately. > > I'm not sure.  The builtin keys most likely will be loaded prior to a > custom IMA policy containing "keyring" rules are defined. > > Mimi I am not sure if I described it clearly - let me clarify: Say, we use ima_policy_flag to determine whether to measure the key immediately or queue the key for measurement and, measure when IMA is initialized. We can incorrectly keep queuing keys in the case when IMA is initialized, but due to the way IMA policy is configured ima_policy_flag is still 0. That's why I feel a separate boolean flag would be needed to know whether IMA is initialized or not. If IMA is initialized, ima_policy_flag will dictate whether to measure the key or not. thanks, -lakshmi