mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: "Guozihua (Scott)" <guozihua@huawei.com>, corbet@lwn.net
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	roberto.sassu@huawei.com, wangweiyang2@huawei.com,
	xiujianfeng@huawei.com, linux-integrity@vger.kernel.org
Subject: Re: [RESEND][PATCH] Documentation: added order requirement for ima_hash=
Date: Tue, 25 Jan 2022 23:37:01 -0500	[thread overview]
Message-ID: <71508a72b042da330d07a624cf499561c46195f0.camel@linux.ibm.com> (raw)
In-Reply-To: <3933adf5-4e9d-6b22-2e46-55643c504f52@huawei.com>

On Wed, 2022-01-26 at 10:28 +0800, Guozihua (Scott) wrote:
> 
> On 2022/1/26 9:07, Mimi Zohar wrote:
> > On Tue, 2022-01-25 at 17:02 +0800, GUO Zihua wrote:
> >> From: Guo Zihua <guozihua@huawei.com>
> >>
> >> 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 <roberto.sassu@huawei.com>
> >> Signed-off-by: Guo Zihua <guozihua@huawei.com>
> > 
> > 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").
> 
> 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.

Ok.  Once the template name is set, ima_template_setup() doesn't allow
it to be reset.  This was probably done to set the template name to the
first occurance of "ima_template=" on the boot command line.  This
concern could be addressed by defining a static local variable in
ima_template_setup().

So either documenting the ordering requirement, as you've done, or
allowing the template_name to be reset are fine.

thanks,

Mimi








  reply	other threads:[~2022-01-26  4:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25  9:02 GUO Zihua
2022-01-26  0:14 ` Jonathan Corbet
2022-01-26  2:32   ` Guozihua (Scott)
2022-01-26  1:07 ` Mimi Zohar
2022-01-26  2:28   ` Guozihua (Scott)
2022-01-26  4:37     ` Mimi Zohar [this message]
2022-01-26  7:41       ` Guozihua (Scott)
2022-01-26 12:47         ` Mimi Zohar
2022-01-26 13:24           ` Roberto Sassu
2022-01-26 14:34             ` Mimi Zohar
2022-01-26 14:43               ` Roberto Sassu
2022-01-26 16:31                 ` Jonathan Corbet
2022-01-27  6:35                 ` Guozihua (Scott)
2022-01-27 12:18                   ` Mimi Zohar
2022-01-28  9:32                     ` Guozihua (Scott)
2022-01-28 10:24           ` Roberto Sassu
2022-01-28 14:33             ` Mimi Zohar
2022-01-28 16:01               ` Roberto Sassu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71508a72b042da330d07a624cf499561c46195f0.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=corbet@lwn.net \
    --cc=guozihua@huawei.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roberto.sassu@huawei.com \
    --cc=wangweiyang2@huawei.com \
    --cc=xiujianfeng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®