Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3834917pxb; Fri, 11 Feb 2022 08:45:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBr01NspCxzmpJS439oYZFdSydctrzX5kmJKOLxiVbn+gdo0ycRMhqR4XJ5J/va6w3xhGQ X-Received: by 2002:a17:906:2ed1:: with SMTP id s17mr2037062eji.441.1644597942996; Fri, 11 Feb 2022 08:45:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644597942; cv=none; d=google.com; s=arc-20160816; b=0NHU1DKcG2oI5fdk5w/tLlUGsF54W5C/pZRNtKWUBfXpgTKg/JIJLIi5jbHu2JXpaX xZ5MBdmp726ZVWstUWaxImByBktoxs76ukVM+io82dHHp74ZY2Lp8vfHSSaDQ9gvtQzu OtH5mHKX262uIndxloHr4x7CtJ7puZZQ7Y1GPO9mAey9pArox8kQ5aXPtbOuUWmWfp2d yWDbLVf0Z0VMRj1tfEXfwlhBcFPJ1Gq2Bgb1Ere62N2bBfQG5JXwqFgptW8G8gOkp3gx 96/vXGPYHgSERrBqDEL5FMrFEu3sePGxUAYSJVqlc/AUCuY4B3kVMbGU1kzGKpwXQW6r 4X/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=QzugTbTTP2waH8jszQXdLrchBO5Z971Ekqe5BFl7Nc0=; b=f8c3soR4/ZAHHqYiizn6fGreW4Kau5J0kwU0DLtkdev8Kf8Xf6zpKRZixTNaJAAkuV Z7I9dQkOlq+d498yvzLjLc53b+F0/BBpRl/U31jPsVNjznZe8oSNbSVg3eHRtz7Q2cwl R2n58Ddw3jcZ6iZyUzhEn15uPXqJ6+zqMokrS2357vZbxTww1vseX71Olu41n2CPhyXe wOp3NQZSvIBWZAACNtpBp2wg9iRipA4MFGnDquwsya+VBrQNwoSNSA7oxhWlkT1NBvN9 27TB6qwiKq7jbs0GgvhBgOb6LarsKRJGEHBCPZPus9AIsuVxb99YP/BY3h3XD2G6HeIY vwIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd32si7467985ejc.543.2022.02.11.08.45.15; Fri, 11 Feb 2022 08:45:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350376AbiBKM6C convert rfc822-to-8bit (ORCPT + 99 others); Fri, 11 Feb 2022 07:58:02 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349140AbiBKM54 (ORCPT ); Fri, 11 Feb 2022 07:57:56 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8DCF1C0; Fri, 11 Feb 2022 04:57:54 -0800 (PST) Received: from fraeml711-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4JwDDQ5zv0z686th; Fri, 11 Feb 2022 20:57:42 +0800 (CST) Received: from fraeml714-chm.china.huawei.com (10.206.15.33) by fraeml711-chm.china.huawei.com (10.206.15.60) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 11 Feb 2022 13:57:52 +0100 Received: from fraeml714-chm.china.huawei.com ([10.206.15.33]) by fraeml714-chm.china.huawei.com ([10.206.15.33]) with mapi id 15.01.2308.021; Fri, 11 Feb 2022 13:57:52 +0100 From: Roberto Sassu To: Mimi Zohar , "shuah@kernel.org" , "ast@kernel.org" , "daniel@iogearbox.net" , "andrii@kernel.org" , "kpsingh@kernel.org" CC: "linux-integrity@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , "netdev@vger.kernel.org" , "bpf@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Florent Revest Subject: RE: [PATCH] ima: Calculate digest in ima_inode_hash() if not available Thread-Topic: [PATCH] ima: Calculate digest in ima_inode_hash() if not available Thread-Index: AQHYHzTu9kKzqhEAHUiW0cSG9MzvPayOOgmAgAAS5hA= Date: Fri, 11 Feb 2022 12:57:52 +0000 Message-ID: <3d0bdb4599e340a78b06094797e42bc9@huawei.com> References: <20220211104828.4061334-1-roberto.sassu@huawei.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.204.63.33] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Mimi Zohar [mailto:zohar@linux.ibm.com] > Sent: Friday, February 11, 2022 1:41 PM > Hi Roberto, > > On Fri, 2022-02-11 at 11:48 +0100, Roberto Sassu wrote: > > __ima_inode_hash() checks if a digest has been already calculated by > > looking for the integrity_iint_cache structure associated to the passed > > inode. > > > > Users of ima_file_hash() and ima_inode_hash() (e.g. eBPF) might be > > interested in obtaining the information without having to setup an IMA > > policy so that the digest is always available at the time they call one of > > those functions. > > Things obviously changed, but the original use case for this interface, > as I recall, was a quick way to determine if a file had been accessed > on the system. Hi Mimi thanks for the info. I was not sure if I should export a new function or reuse the existing one. In my use case, just calculating the digest would be sufficient. For finding whether a file was accessed (assuming that it matches the policy), probably bpf_ima_inode_hash() is not anyway too reliable. If integrity_iint_cache is evicted from the memory, it would report that the inode was not accessed even if it was. Thanks Roberto HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063 Managing Director: Li Peng, Zhong Ronghua > -- > thanks, > > Mimi