lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <97142483-d7e7-e310-0cb0-30a81414cb57@huawei.com>
Date:   Wed, 26 Jan 2022 15:41:45 +0800
From:   "Guozihua (Scott)" <guozihua@...wei.com>
To:     Mimi Zohar <zohar@...ux.ibm.com>, <corbet@....net>
CC:     <linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <roberto.sassu@...wei.com>, <wangweiyang2@...wei.com>,
        <xiujianfeng@...wei.com>, <linux-integrity@...r.kernel.org>
Subject: Re: [RESEND][PATCH] Documentation: added order requirement for
 ima_hash=



On 2022/1/26 12:37, Mimi Zohar wrote:
> 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@...wei.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@...wei.com>
>>>> Signed-off-by: Guo Zihua <guozihua@...wei.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
> 
> .

The main issue lies in ima_template_desc_current called by hash_setup, 
which does not just read ima_template global variable, but also tries to 
set it if that hasn't been done already. Causing ima_template_setup to quit.

-- 
Best
GUO Zihua

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ