Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp351410ybx; Wed, 6 Nov 2019 18:21:34 -0800 (PST) X-Google-Smtp-Source: APXvYqyWTvuBgqjsJHdmtMPrMdv+ZN1DB5WVqkBBCbJcITFhLPONAVbRbMw/7J+MMkCHbwFVIfP1 X-Received: by 2002:a17:906:3019:: with SMTP id 25mr803962ejz.280.1573093294710; Wed, 06 Nov 2019 18:21:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573093294; cv=none; d=google.com; s=arc-20160816; b=hUqr0IrBdJvEfTOiGPBewjKe996RMYywWWuyX8JcGMevdt9ikjypcDXc19T6/7Jb+k B/iCmU+jS81ctiFtOtfZjftXyfGDRIjWtoHYJN6WMAEG26XZbX4IOxbeusJo1WC1FdUX 6KGndI8/8E5u49xw3AJFNejXrmQCcSoG3lDeUoSBTLvxREho0jDGsW1GrEbx/kGzjC2I eY+W+ePbfVrcV0gLmReR28A2pWJYw4wTRR8N0XWOfykJwchgZLhiQYsR+rTzc+CJkc9Q BbXO0z4sszOJGfX2GP9akLKEp56Ldtq1hm9QNvdK5Ryz/xai3wf6/xEWgwNDrwgt6vUQ OBVg== 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=ANqKC9zirBL5qVf7a2LGzuVHY9L9E5urFo/RJfIMoL0=; b=XIJST++tZiYe6siRRQRQUcLNjPdm5e5V0xhxTud2yczEQ1L+Agk5Jx6DUmMQpH/EtF lI88qyHUlx6rSRRopZbJWX9MgV1hLb7sevjiHde+m3U0U9ie0S47pFB4H9iXU6RHVOvN VqappKjSWGHnxOsrzNREm80tRk+P3f0AU3yC46YatitV6KZyiyIymZl/mZ/b0wl7hJXn F1KAHSen7iwz8Xy3z/ISoLU0U9kmTpLFLNLszC3eAGd/SywFBDZGubX+4EsmoHNuM/GG HOvz8BHoRjO730NflTMjfmte4uK+Go35dTYGVUgGy342++TpBFN18HUVLqH93Q2jek2v 4qiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=BE4ywyGS; 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 f29si339768edb.337.2019.11.06.18.21.11; Wed, 06 Nov 2019 18:21:34 -0800 (PST) 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=BE4ywyGS; 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 S1732977AbfKGCUN (ORCPT + 99 others); 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