From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81E32C2D0A8 for ; Mon, 28 Sep 2020 17:12:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 512DA20773 for ; Mon, 28 Sep 2020 17:12:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726635AbgI1RMo (ORCPT ); Mon, 28 Sep 2020 13:12:44 -0400 Received: from mga12.intel.com ([192.55.52.136]:55534 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726348AbgI1RMo (ORCPT ); Mon, 28 Sep 2020 13:12:44 -0400 IronPort-SDR: JUnFEodwvNCy7ZFra21yOVKRiitIY4P1oQTinpPOtM2Nhad+V7N6noysL79bBs4Ub5SU2avYGt /u5/HJLdt5fA== X-IronPort-AV: E=McAfee;i="6000,8403,9758"; a="141437254" X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="141437254" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 10:12:43 -0700 IronPort-SDR: Uv+n6jt9GG5EmsFF1YJGbGEn9CtZ6b4LPpBZJTgN2GGWI16laY2+QfTpfxZXK4hQjjhYOyL1m1 sAG+uge1/LJw== X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="488667581" Received: from evinhugx-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.44.118]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 10:12:40 -0700 Date: Mon, 28 Sep 2020 20:12:39 +0300 From: Jarkko Sakkinen To: Ard Biesheuvel Cc: Kai-Heng Feng , "Kenneth R. Crudup" , Tyler Hicks , linux-integrity , open list , Matthew Garrett , tweek@google.com Subject: Re: [Regression] "tpm: Require that all digests are present in TCG_PCR_EVENT2 structures" causes null pointer dereference Message-ID: <20200928171238.GB119268@linux.intel.com> References: <20200928140623.GA69515@linux.intel.com> <20200928155215.GA92669@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On Mon, Sep 28, 2020 at 06:15:00PM +0200, Ard Biesheuvel wrote: > > > > It is possible but initially feels a bit weird: > > > > > > > > - sizeof(TCG_SPECID_SIG)) || count > efispecid->num_algs) { > > > > + sizeof(TCG_SPECID_SIG)) || > > > > + !efispecid->num_algs || count != efispecid->num_algs) { ^^^ > In tpm2_bios_measurements_start(), we dereference tpm_bios_log to > access bios_event_log and bios_event_log_end without checking tpm_bios > for NULL. This is where the crash seems to occur. That's a good guess. Just a bit confused how that particular patch can have the effect: it has two deferences to efispecid instead of one in the same statement. Would be interesting to hear if the bug is triggered in Kenneth's environment by the exact same commit. /Jarkko