Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5259597pxb; Wed, 26 Jan 2022 08:06:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5Br0xyNUXrBORQfXVpKrTwTdn1JjIuxpQEqjmK5SvNylHIpq+pyd6Tr3wrI3XouBNg4zq X-Received: by 2002:a17:902:cec7:b0:14b:5198:9c8f with SMTP id d7-20020a170902cec700b0014b51989c8fmr13962236plg.151.1643213205925; Wed, 26 Jan 2022 08:06:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643213205; cv=none; d=google.com; s=arc-20160816; b=qnYNsDV+9XQQK61IMltGci1SOjP/zUltL9lJi+v7E/WZ+iR/Pi+Ag4kIbh3g7+9WCQ sCLgN0NpGcTYo4y2D0ORAjol7k5019sie2yJT30lk0y+T3FaD8sQFBrtroj4tCtXigeq yz/mZN1KeMpmzEtssFGtRzFIfC5CatjaBH228xLAMzOYT7KyUGMTjRqMntbWe7HFSbs7 pbX+rfHEtjh1thPJXRZqDyRgpmW5xKn+CCUjlDO8TYjj0v9YxPtRvjwKfaHQWqs5xK9d 309HfQyZw1fT6r4dvMjBOhJdt6HSBgPA82mcvASQMhRcIO8jjp8o1o9vMEjfLd+uQYQY TXGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=AThwPXHk5xp5he+kuRIGzZnpx9s7TM8Rfl/KkwnpuqU=; b=QOxE1+QCCf8xpvyQQwXSswMOkNl187/bIU5LxmBgr/pXWEvzP14Hdyb+Tg2PirbWcC CiwjERJ533xR4k+0vsL5eg3N/rE90l64IQ+EpeKshamKmiwwIHR0x6eiKEucUuxDYP9P 4n32dE7mMGSPnKu8RZ4PI05VJzuiCR58dTgP47h/jFbaRDQKMrHrVPm/K0I4T2ly/I+k CFUadJahW1fWYy+3SQ9e2uS7r/P8xqMaSJqUEOYUo6dfWNsXJQWxS9ytRI/1VdTLcRnU 4XBxOQAPuj+F1E5OZtKtDmj8D9zM0Z676xF6+Gv1UCH/JynDLoD0vni6Jb0Agwp/IGB7 hYYA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k71si16847560pga.357.2022.01.26.08.06.33; Wed, 26 Jan 2022 08:06:45 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236388AbiAZC2L (ORCPT + 99 others); Tue, 25 Jan 2022 21:28:11 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:35870 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236373AbiAZC2K (ORCPT ); Tue, 25 Jan 2022 21:28:10 -0500 Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jk70Q1cHvzcckc; Wed, 26 Jan 2022 10:27:18 +0800 (CST) Received: from [10.67.110.173] (10.67.110.173) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 26 Jan 2022 10:28:07 +0800 Message-ID: <3933adf5-4e9d-6b22-2e46-55643c504f52@huawei.com> Date: Wed, 26 Jan 2022 10:28:07 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [RESEND][PATCH] Documentation: added order requirement for ima_hash= Content-Language: en-US To: Mimi Zohar , CC: , , , , , References: <20220125090237.120357-1-guozihua@huawei.com> <36b6058f2cdf6bead917c06ecc6e8769bb88130c.camel@linux.ibm.com> From: "Guozihua (Scott)" In-Reply-To: <36b6058f2cdf6bead917c06ecc6e8769bb88130c.camel@linux.ibm.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.110.173] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500024.china.huawei.com (7.185.36.203) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/1/26 9:07, Mimi Zohar wrote: > On Tue, 2022-01-25 at 17:02 +0800, GUO Zihua wrote: >> From: Guo Zihua >> >> Commandline parameter ima_hash= and ima_template= has order requirement >> for them to work correctly together. Namely ima_hash= must be >> specified after ima_template=, otherwise ima_template= will be ignored. >> >> The reason is that when handling ima_hash=, ima template would be set to >> the default value if it has not been initialized already, and that value >> cannot be changed afterwards by ima_template=. >> >> This patch adds this limitation to the documentation. >> >> Reviewed-by: Roberto Sassu >> Signed-off-by: Guo Zihua > > This issue should be limited to the original "ima" template format, > which only supports hash algorithms of 20 bytes or less. The "ima_ng" > template has been the default since larger digests and templates were > upstreamed back in Linux 3.13[1]. Do you really still have kernels > built with the original "ima" template? > > [1] Refer to commit 4286587dccd4 ("ima: add Kconfig default measurement > list template"). > > thanks, > > Mimi Hi Mimi, The issue is that if ima_hash is specified before ima_template, ima_template will not work. Built-in default only affects which template will be loaded eventually. For example, if the built-in default template is ima-ng and user would like to change it to ima-sig with sha512 by specifying "ima_hash=sha512 ima_template=ima-sig" in command line, the result will be ima-ng with sha512, not ima-sig with sha512. -- Best GUO Zihua > >> --- >> Documentation/admin-guide/kernel-parameters.txt | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt >> index f5a27f067db9..1b5aa6ca65f8 100644 >> --- a/Documentation/admin-guide/kernel-parameters.txt >> +++ b/Documentation/admin-guide/kernel-parameters.txt >> @@ -1843,6 +1843,10 @@ >> The list of supported hash algorithms is defined >> in crypto/hash_info.h. >> >> + This parameter must be specified after ima_template=, >> + as it would set the default template and that cannot be >> + changed by ima_template= afterwards. >> + >> ima_policy= [IMA] >> The builtin policies to load during IMA setup. >> Format: "tcb | appraise_tcb | secure_boot | >> @@ -1879,6 +1883,9 @@ >> Formats: { "ima" | "ima-ng" | "ima-sig" } >> Default: "ima-ng" >> >> + This parameter must be specified before ima_hash=. >> + Please refer to ima_hash= for further explanation. >> + >> ima_template_fmt= >> [IMA] Define a custom template format. >> Format: { "field1|...|fieldN" } > > > .