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=-13.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,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 C39B2C433E0 for ; Thu, 30 Jul 2020 03:41:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A108A22BEA for ; Thu, 30 Jul 2020 03:41: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="bizhjV3S" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728505AbgG3Dll (ORCPT ); Wed, 29 Jul 2020 23:41:41 -0400 Received: from linux.microsoft.com ([13.77.154.182]:52676 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726342AbgG3Dlk (ORCPT ); Wed, 29 Jul 2020 23:41:40 -0400 Received: from [192.168.0.104] (c-73-42-176-67.hsd1.wa.comcast.net [73.42.176.67]) by linux.microsoft.com (Postfix) with ESMTPSA id 1C56320B4908; Wed, 29 Jul 2020 20:41:40 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1C56320B4908 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1596080500; bh=SSgbPP9kDZLovED2Z/+QlPvME41I7wBz0odZxt5w7A0=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=bizhjV3Sq57DpB3Dye03VgBufFalczAqpkydQCw+ZC3oKRkxB45Va5icWsSyO27Rd T2L5LmEj7L3o5aWzuYz+6f72EPJ3xWlDY9KjJVGREF+JMLWHZqlFfJBy62uZPBkcPu e/1Byk50QddvVpZMWBvq3KdC1AehYtlhKT3DwXhU= Subject: Re: Measure data again even when it has not changed To: Mimi Zohar , linux-integrity@vger.kernel.org Cc: Tyler Hicks References: <8bcf778d-8fa8-9985-43d7-c2b80d8d8445@linux.microsoft.com> <59f23e8953c0735695e5679fc7b7021252837874.camel@linux.ibm.com> From: Lakshmi Ramasubramanian Message-ID: Date: Wed, 29 Jul 2020 20:41:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <59f23e8953c0735695e5679fc7b7021252837874.camel@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On 7/29/20 8:23 PM, Mimi Zohar wrote: > On Wed, 2020-07-29 at 10:17 -0700, Lakshmi Ramasubramanian wrote: >> Hi Mimi, >> >> I have a query related to measuring data (by IMA subsystem) when that >> data has been already been measured. >> >> Consider the following sequence of events: >> >> => At time T0 IMA hook is called by another subsystem to measure data >> "foo". IMA measures it. >> >> => At time T1 data is "bar". IMA measures it. >> >> => At time T2 data is "foo" again. But IMA doesn't measure it since it >> is already in the measured list. >> >> But for the subsystem making the call to IMA, the state has changed and >> "foo" has to be measured again. >> >> One way to address the above is to use unique "event name" in each call >> so that IMA measures the given data every time. >> >> Is there a better way to address the above? > > Most likely the file is being re-measured, but the new value already exists in > the hash table so it isn't being added to the IMA measurement list or extending > the TPM. When IMA was upstreamed, there was concern about TPM performance and > the number of measurements being extended. We've improved TPM performance quite > a bit. If you're not concerned about TPM performance, I would define a new > template data field based on i_version. In the use case I am considering the entity being measured is not a file, but a memory buffer - it is for measuring an LSM's data constructs. So i_version is not available in this case. When LSM's data changes from A to B and then back to A, hash(A) already exists in IMA's hash table. So A is not measured again. Since LSM state change is not expected to be frequent, TPM performance shouldn't be a concern. thanks, -lakshmi