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 65695CA9EBC for ; Fri, 25 Oct 2019 17:32:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36386205C9 for ; Fri, 25 Oct 2019 17:32:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="b4k6pMTq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505930AbfJYRch (ORCPT ); Fri, 25 Oct 2019 13:32:37 -0400 Received: from linux.microsoft.com ([13.77.154.182]:44696 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2505918AbfJYRcg (ORCPT ); Fri, 25 Oct 2019 13:32:36 -0400 Received: from [10.137.112.111] (unknown [131.107.147.111]) by linux.microsoft.com (Postfix) with ESMTPSA id 842D42010AC6; Fri, 25 Oct 2019 10:32:35 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 842D42010AC6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1572024755; bh=iHY0BIhRWj4FzzaW9EX78Sx4D3Z7kMMY/gOg/k9uflQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=b4k6pMTqdO0i5AHVntdRqb4yi/qWfuDe297Y4pVfsE9IwlqDobrs/tLPUl+9ivN5b zC09JHzsrtGqzkxAf1TyRDOKYDtFhWkiwt8kKCn6n+8juEF+oUKh/Xre6rTa7V7oqx gXpCwzYTGfcDpRGf+rPMrMDWxHAqu7BtE/1yEZ+s= Subject: Re: [PATCH v9 5/8] ima: make process_buffer_measurement() generic To: Nayna Jain , Nayna Jain , linuxppc-dev@ozlabs.org, linux-efi@vger.kernel.org, linux-integrity@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Ard Biesheuvel , Jeremy Kerr , Matthew Garret , Mimi Zohar , Greg Kroah-Hartman , Claudio Carvalho , George Wilson , Elaine Palmer , Eric Ricther , Oliver O'Halloran , Prakhar Srivastava References: <20191024034717.70552-1-nayna@linux.ibm.com> <20191024034717.70552-6-nayna@linux.ibm.com> <1ae56786-4d5c-ba8e-e30c-ced1e15ccb9c@linux.microsoft.com> <24cf44d5-a1f0-f59e-9884-c026b1ee2d3b@linux.vnet.ibm.com> From: Lakshmi Ramasubramanian Message-ID: <8a97301a-0e25-2718-bd81-d778cb58e1d3@linux.microsoft.com> Date: Fri, 25 Oct 2019 10:32:53 -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: <24cf44d5-a1f0-f59e-9884-c026b1ee2d3b@linux.vnet.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 10:24 AM, Nayna Jain wrote: > > On 10/24/19 10:20 AM, Lakshmi Ramasubramanian wrote: >> On 10/23/19 8:47 PM, Nayna Jain wrote: >> >> Hi Nayna, >> >>> +void process_buffer_measurement(const void *buf, int size, >>> +                const char *eventname, enum ima_hooks func, >>> +                int pcr) >>>   { >>>       int ret = 0; >>>       struct ima_template_entry *entry = NULL; >> >>> +    if (func) { >>> +        security_task_getsecid(current, &secid); >>> +        action = ima_get_action(NULL, current_cred(), secid, 0, func, >>> +                    &pcr, &template); >>> +        if (!(action & IMA_MEASURE)) >>> +            return; >>> +    } >> >> In your change set process_buffer_measurement is called with NONE for >> the parameter func. So ima_get_action (the above if block) will not be >> executed. >> >> Wouldn't it better to update ima_get_action (and related functions) to >> handle the ima policy (func param)? > > > The idea is to use ima-buf template for the auxiliary measurement > record. The auxiliary measurement record is an additional record to the > one already created based on the existing policy. When func is passed as > NONE, it represents it is an additional record. I am not sure what you > mean by updating ima_get_action, it is already handling the ima policy. > I was referring to using "func" in process_buffer_measurement to determine ima action. In my opinion, process_buffer_measurement should be generic. ima_get_action() should instead determine the required ima action, template, pcr, etc. based on "func" passed to it. thanks, -lakshmi