Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4519352pxv; Tue, 27 Jul 2021 09:14:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNJlmzzoElEbHI6XTJQ/GblRr17NYUd+OfsYbCXR6ChER4VukOf5gah6v24ZBefOYYVIax X-Received: by 2002:a02:c906:: with SMTP id t6mr2863205jao.23.1627402476932; Tue, 27 Jul 2021 09:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627402476; cv=none; d=google.com; s=arc-20160816; b=Q9xmYvHkzC02PnT99j8EqtNtJ8mejFE9Ox2Uz4b/GNLCtlgCJWRd7iEsvXYyTooBPs 0QlSNm7QYqiyAAGAYsyxY3hl8DYAKUuYj9rYdj/W9jeHH00pIQXulVORbVtfEPesaObW U84GfqaSUWbDSqaIgUetwKlicm4yXI+CWpTKtwOTOqikqImFuDOyiiMTB8mwRVE1bHhj 7GWfSPVjbTV2mlvSpX0zz2ChLt1z0MiwW6BLKxdtJFwgpQ4TY2NQK1RlxAo0MRwyAiQh H5fmSdpev/Y+vMc7R1+c2lVRp21vEIXSEZTPQ73cmTVOKUiJYYE6Goo4Sq88fbwZPIlm cOGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GpjVwosP3ndSwsA0tBQKhnm0d0c8gdxwWXB932Aexho=; b=ZmZTwa1BbXru5kHlK3zWUSPBbEmoImmiFuQsKRmogTHlWhPfjt9mDx1pngJDELzyHh /C5cTr37M5DOvV8pLAlYDh8LUNNYefHlqN0/sIrY0eqSr42+4yO2N1qVnJJHcQho6jtZ dS+WrrOYrqZbU0YlPaiE8Cps2H6bcN1u5Bjuo0Out5tek3mWoUjz5/yuc3IIkt9OJDVb MiWA+hpyrPug4qiqDR0HWnSoVw74Pn1dHJP5j3HyI3DqlPewe5cSr7NCVF82hIYQ2USX AmeFAL2VLpFW6ol1oUCChHbwxwNgFrVXEQ0x5VHbztORUraVLCjjEEGLXlg3vv65xLm5 AjEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Xv8/cedo"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si3997743ile.135.2021.07.27.09.14.24; Tue, 27 Jul 2021 09:14:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Xv8/cedo"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbhG0QNh (ORCPT + 99 others); Tue, 27 Jul 2021 12:13:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:58672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbhG0QNa (ORCPT ); Tue, 27 Jul 2021 12:13:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D253461B5F; Tue, 27 Jul 2021 16:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627402410; bh=cSvv7h1KI4rEs+b/XRGdLLHF0kCjqbmt0F4Q4/KmUFg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Xv8/cedoNSRYzYwwcD6vrJcRh3eIMNt6B53Peuj8Gwi0QgaQ6tAEW78TP+cnpeHcY 0yVj5udDCtA9i9ywyVsTIw4JkuljUGSwzmxkwlDZ23Mmi+l0coIWNE93O7FOVkOK+k fIj/uoRdVYi40WTN0E1zZgzvAQA+Kk9KkhDMwqiI= Date: Tue, 27 Jul 2021 18:13:28 +0200 From: Greg KH To: Roberto Sassu Cc: "zohar@linux.ibm.com" , "mchehab+huawei@kernel.org" , "linux-integrity@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [RFC][PATCH v2 02/12] diglim: Basic definitions Message-ID: References: <20210726163700.2092768-1-roberto.sassu@huawei.com> <20210726163700.2092768-3-roberto.sassu@huawei.com> <4746947088404edaa31594fb095a6e46@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4746947088404edaa31594fb095a6e46@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 27, 2021 at 04:09:37PM +0000, Roberto Sassu wrote: > > From: Greg KH [mailto:gregkh@linuxfoundation.org] > > Sent: Tuesday, July 27, 2021 5:44 PM > > On Tue, Jul 27, 2021 at 03:35:16PM +0000, Roberto Sassu wrote: > > > > From: Greg KH [mailto:gregkh@linuxfoundation.org] > > > > Sent: Tuesday, July 27, 2021 4:44 PM > > > > On Mon, Jul 26, 2021 at 06:36:50PM +0200, Roberto Sassu wrote: > > > > > --- /dev/null > > > > > +++ b/include/uapi/linux/diglim.h > > > > > @@ -0,0 +1,51 @@ > > > > > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ > > > > > +/* > > > > > + * Copyright (C) 2017-2021 Huawei Technologies Duesseldorf GmbH > > > > > + * > > > > > + * Author: Roberto Sassu > > > > > + * > > > > > + * DIGLIM definitions exported to user space, useful for generating > > digest > > > > > + * lists. > > > > > + */ > > > > > + > > > > > +#ifndef _UAPI__LINUX_DIGLIM_H > > > > > +#define _UAPI__LINUX_DIGLIM_H > > > > > + > > > > > +#include > > > > > +#include > > > > > + > > > > > +enum compact_types { COMPACT_KEY, COMPACT_PARSER, > > > > COMPACT_FILE, > > > > > + COMPACT_METADATA, COMPACT_DIGEST_LIST, > > > > COMPACT__LAST }; > > > > > + > > > > > +enum compact_modifiers { COMPACT_MOD_IMMUTABLE, > > > > COMPACT_MOD__LAST }; > > > > > + > > > > > +enum compact_actions { COMPACT_ACTION_IMA_MEASURED, > > > > > + COMPACT_ACTION_IMA_APPRAISED, > > > > > + COMPACT_ACTION_IMA_APPRAISED_DIGSIG, > > > > > + COMPACT_ACTION__LAST }; > > > > > + > > > > > +enum ops { DIGEST_LIST_ADD, DIGEST_LIST_DEL, > > DIGEST_LIST_OP__LAST }; > > > > > + > > > > > +/** > > > > > + * struct compact_list_hdr - header of the following concatenated > > digests > > > > > + * @version: version of the digest list > > > > > + * @_reserved: field reserved for future use > > > > > + * @type: type of digest list among enum compact_types > > > > > + * @modifiers: additional attributes among (1 << enum > > compact_modifiers) > > > > > > > > I do not understand this description, what does it mean? > > > > > > Hi Greg > > > > > > yes, it is not very clear. > > > > > > @modifiers is a bitmask where each bit corresponds to a different > > > attribute. enum compact_modifiers defines which bit position is > > > assigned to each attribute. > > > > Watch out with endian issues and bitmasks... Anyway, please document > > this. > > > > > > > > > > + * @algo: digest algorithm > > > > > > > > Is this also a #define or an enum? Where is the list of them? > > > > > > @algo is an enum defined in include/uapi/linux/hash_info.h. > > > > Please say that. > > > > > > > + * @count: number of digests > > > > > + * @datalen: length of concatenated digests > > > > > > > > Where does this count and length come into play as nothing else is in > > > > this structure? > > > > > > Each digest list must begin with this structure. From it, the parser knows > > > how much data it should expect afterwards. After the data, there could be > > > another or more blocks of this structure and following data. > > > > Ah, that was not obvious at all :) > > > > Why do you not have a __u8 data[]; type field as the last one here for > > that memory so you can access it easier? > > After the digest list is parsed, I'm accessing the digest with the offset from > the beginning of the digest list. If the offset was relative to the header, it could > have been useful. I could add the new field, but I'm afraid of the incompatibility > with existing tools that we have. What tools? This isn't a feature in the kernel yet, so we have no legacy to support, right? thanks, greg k-h