Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp628193ybm; Thu, 28 May 2020 11:07:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5gRGztQAo+BI20ftlzD8zKxu9+dEmURqdwx6maibZGz4y3ORpcqJBItLFnIY7f8Ak49Qm X-Received: by 2002:a05:6402:148d:: with SMTP id e13mr4560911edv.200.1590689242301; Thu, 28 May 2020 11:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590689242; cv=none; d=google.com; s=arc-20160816; b=q5z+CZdcbvxOrhNGCjIv2Hkj8gNbJfXwkdPHlAl8hYEp74GKKW91XYY+3fPfm2EUyo fe8/AfXArdzuIBbjiDlRitboQgG0QvRVkhWIXOZiQLJoCVcRFiscnpDjKJrOnXCsoCJy NL6s1XAuBxgjyeoUayBo+1TF0oY05K+W9RnTS/yWa/zQbHkqz7ibliTe+BSUJPwWAm2N tpIEF3t+1sxwPuX1Le+TyD3F4SwVO7lGPp25rBQR0bgDJ7un6cxGsqeLg4hffZbOoGWS COy/h1m2bHoqwywaAXaoce+qA9atmUN636VJBhAkVH+x+tBvhIKGarDo9KfBvuHaiNpy 8LVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=ghn+NmCHsw6stBzQGBpHUcNR7kKrx8N67TFFIdqX2og=; b=L2qH07v24RpXt1d2Gz8KIXi7p/GBpAKi/9wszOWNr6/ltcq2A4mTsFzSP+w1Jps8s1 WtdWEbaJ2NJn8XDG0RqpsXiDIgGV2aPxO04FxUiJdD6g2zZQysSqEwY5Vz25462x4YhV 4pK5m6d0HaMKSwCwFEODI04SuFF4GG/dSbze82de2HUujCnkTlkFB1LFqWZZSFwnk3v9 aFL3O29GsatxSE951vYZ9BPyWU5HYUzdXgTvYkNw6SRGjs+7VxmCyYoKxZf9tSaOIjjt I/+W0BNBn7L4wfm+SlKMt0AikZSRKlB4BBAHZN8BDU2CN0xLSqoKDp43+PH3+NHf1Phs JhpQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 9si4416362ejf.668.2020.05.28.11.06.57; Thu, 28 May 2020 11:07:22 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391342AbgE1SCb (ORCPT + 99 others); Thu, 28 May 2020 14:02:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:38322 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388240AbgE1SCa (ORCPT ); Thu, 28 May 2020 14:02:30 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7CE13ACA0; Thu, 28 May 2020 18:02:27 +0000 (UTC) Date: Thu, 28 May 2020 20:02:27 +0200 Message-ID: From: Takashi Iwai To: Roberto Sassu Cc: "linux-integrity@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Silviu Vlasceanu" Subject: Re: Oops at boot with linux-next kernel with IMA boot options In-Reply-To: <4de686af78e94893b3578f6970d783d5@huawei.com> References: <4de686af78e94893b3578f6970d783d5@huawei.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; >