lkml.org 
[lkml]   [2020]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Oops at boot with linux-next kernel with IMA boot options
On Thu, 28 May 2020 19:36:55 +0200,
Roberto Sassu wrote:
>
> > From: linux-integrity-owner@vger.kernel.org [mailto:linux-integrity-
> > owner@vger.kernel.org] On Behalf Of Takashi Iwai
> > 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...
>
> Hi Takashi
>
> boot_aggregate is the only entry for which there is no file descriptor.
> The file descriptor is used to recalculate the digest if it is not SHA1
> or MD5. For boot_aggregate, we should use instead
> ima_calc_boot_aggregate(). I will provide a patch.
>
> I see that the .file member of event_data in
> ima_add_boot_aggregate() is not initialized. Can you please try
> to set .file to NULL?

Tested and it didn't help. The field was already zero-initialized via
C99-style initialization, I believe.


thanks,

Takashi

>
> Thanks
>
> Roberto
>
> HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063
> Managing Director: Li Peng, Li Jian, Shi Yanli
>
> > 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;
>

\
 
 \ /
  Last update: 2020-05-28 20:02    [W:0.062 / U:2.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site