From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lakshmi Ramasubramanian Date: Thu, 07 Nov 2019 02:20:11 +0000 Subject: Re: [PATCH v4 08/10] IMA: Defined functions to queue and dequeue keys for measurement Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit List-Id: References: <20191106190116.2578-1-nramas@linux.microsoft.com> <20191106190116.2578-9-nramas@linux.microsoft.com> <1573080281.5028.314.camel@linux.ibm.com> In-Reply-To: <1573080281.5028.314.camel@linux.ibm.com> To: Mimi Zohar , dhowells@redhat.com, matthewgarrett@google.com, sashal@kernel.org, jamorris@linux.microsoft.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org On 11/6/19 2:44 PM, Mimi Zohar wrote: Hi Mimi, >> + >> + if (ima_initialized) { > > ima_initialized is being set in ima_init(), before a custom policy is > loaded.  I would think that is too early.  ima_update_policy() is > called after loading a custom policy.  Please see how to detect when a > custom policy is loaded. ima_init_policy() is called before ima_initialized flag is set. As far as I understand ima_init_policy() loads custom policies as well. So custom policies (such as arch specific policies, secure boot policies, etc.) are loaded before the queued keys are processed. But if CONFIG_IMA_WRITE_POLICY is enabled, the policy can be updated anytime. This scenario is not handled in my implementation. Please correct me if my understanding is wrong. thanks, -lakshmi 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 5C683FC6194 for ; Thu, 7 Nov 2019 02:20:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 259AB2187F for ; Thu, 7 Nov 2019 02:20:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="BE4ywyGS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732996AbfKGCUN (ORCPT ); Wed, 6 Nov 2019 21:20:13 -0500 Received: from linux.microsoft.com ([13.77.154.182]:48800 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727751AbfKGCUM (ORCPT ); Wed, 6 Nov 2019 21:20:12 -0500 Received: from [10.137.112.108] (unknown [131.107.174.108]) by linux.microsoft.com (Postfix) with ESMTPSA id D31A720B7192; Wed, 6 Nov 2019 18:20:11 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D31A720B7192 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1573093211; bh=ANqKC9zirBL5qVf7a2LGzuVHY9L9E5urFo/RJfIMoL0=; h=Subject:To:References:From:Date:In-Reply-To:From; b=BE4ywyGSSwGkBhjWTxO594+Es8EzO/EXt+Y1G9pwAUUyBvB2ZFoEfbTWUxWLGo42i +B+7AcJrTK+tuf3gs7iqJIK6dubUMt+Z3EDhtVRDr9gic04bFgdGTlFojGXvJsG/e/ D2tQ23Cd2VtkBCbZxj4xrj0eWlCzaluhj8R8n0us= Subject: Re: [PATCH v4 08/10] IMA: Defined functions to queue and dequeue keys for measurement To: Mimi Zohar , dhowells@redhat.com, matthewgarrett@google.com, sashal@kernel.org, jamorris@linux.microsoft.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org References: <20191106190116.2578-1-nramas@linux.microsoft.com> <20191106190116.2578-9-nramas@linux.microsoft.com> <1573080281.5028.314.camel@linux.ibm.com> From: Lakshmi Ramasubramanian Message-ID: Date: Wed, 6 Nov 2019 18:20:11 -0800 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: <1573080281.5028.314.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 11/6/19 2:44 PM, Mimi Zohar wrote: Hi Mimi, >> + >> + if (ima_initialized) { > > ima_initialized is being set in ima_init(), before a custom policy is > loaded.  I would think that is too early.  ima_update_policy() is > called after loading a custom policy.  Please see how to detect when a > custom policy is loaded. ima_init_policy() is called before ima_initialized flag is set. As far as I understand ima_init_policy() loads custom policies as well. So custom policies (such as arch specific policies, secure boot policies, etc.) are loaded before the queued keys are processed. But if CONFIG_IMA_WRITE_POLICY is enabled, the policy can be updated anytime. This scenario is not handled in my implementation. Please correct me if my understanding is wrong. thanks, -lakshmi