linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Roberto Sassu <roberto.sassu@huawei.com>
Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Oops at boot with linux-next kernel with IMA boot options
Date: Thu, 28 May 2020 18:37:12 +0200	[thread overview]
Message-ID: <s5hk10wm2x3.wl-tiwai@suse.de> (raw)
In-Reply-To: <s5htv00m5sb.wl-tiwai@suse.de>

On Thu, 28 May 2020 17:35:16 +0200,
Takashi Iwai wrote:
> 
> Hi Roberto,
> 
> it seems that the recent changes in IMA in linux-next caused a
> regression: namely it triggers an Oops when booting with the options
>   ima_policy=tcb ima_template_fmt='d-ng|n-ng|d|ng'

And further experiment revealed that passing only ima_template_fmt=d
is enough for triggering the bug.  Other formats don't matter.

(snip)
> It's a KVM instance without any TPM stuff, just passed the options
> above.  I could trigger the same bug on a bare metal, too.
> 
> Then I performed bisection and it spotted the commit:
> 6f1a1d103b48b1533a9c804e7a069e2c8e937ce7
>   ima: Switch to ima_hash_algo for boot aggregate
> 
> Actually reverting this commit fixed the Oops again.

So, looking at the fact above (triggered by "d") and this bisection
result, it seems that the issue is specific to ima_eventdigest_init().
The difference from others is that this has a check by
ima_template_hash_algo_allowed(), and currently the check allows only
SHA1 and MD5, while now SHA256 is assigned as default.  So I tested
adding SHA256 there like below, and it seems working.

Hopefully I'm heading to a right direction...


thanks,

Takashi

--- a/security/integrity/ima/ima_template_lib.c
+++ b/security/integrity/ima/ima_template_lib.c
@@ -13,7 +13,8 @@
 
 static bool ima_template_hash_algo_allowed(u8 algo)
 {
-	if (algo == HASH_ALGO_SHA1 || algo == HASH_ALGO_MD5)
+	if (algo == HASH_ALGO_SHA1 || algo == HASH_ALGO_SHA256 ||
+	    algo == HASH_ALGO_MD5)
 		return true;
 
 	return false;

  reply	other threads:[~2020-05-28 16:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 15:35 Oops at boot with linux-next kernel with IMA boot options Takashi Iwai
2020-05-28 16:37 ` Takashi Iwai [this message]
2020-05-28 17:36   ` Roberto Sassu
2020-05-28 18:02     ` Takashi Iwai
2020-05-29  7:33       ` Roberto Sassu
2020-05-29  7:45         ` Takashi Iwai
2020-05-31 18:50           ` Mimi Zohar

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=s5hk10wm2x3.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roberto.sassu@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;
as well as URLs for NNTP newsgroup(s).