All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tyler Hicks <tyhicks@linux.microsoft.com>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>,
	"Kenneth R . Crudup" <kenny@panix.com>,
	Mimi Zohar <zohar@linux.ibm.com>
Cc: "Peter Huewe" <peterhuewe@gmx.de>,
	"Jarkko Sakkinen" <jarkko@kernel.org>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-efi@vger.kernel.org, "Thiébaud Weksteen" <tweek@google.com>,
	"Ard Biesheuvel" <ardb@kernel.org>
Subject: Re: [PATCH] tpm: efi: Don't create binary_bios_measurements file for an empty log
Date: Wed, 28 Oct 2020 12:39:58 -0500	[thread overview]
Message-ID: <20201028173958.GA4624@sequoia> (raw)
In-Reply-To: <20201028163002.GA5150@sequoia>

On 2020-10-28 11:30:11, Tyler Hicks wrote:
> So, we need help from Kai, Kenneth, or Mimi to verify my assumption that
> their firmware is providing an empty main event log and a populated
> final event log.

Hi Kai, Kenneth, and Mimi - could one or two of you please follow these
steps:

1) Apply the proposed patch in the grandparent of this email so that
   your kernel doesn't crash
2) Revert commit 7f3d176f5f7e ("tpm: Require that all digests are
   present in TCG_PCR_EVENT2 structures") so that
   __calc_tpm2_event_size() goes back to being less picky and may treat
   a final log event as a valid event log header
3) Add some debugging warnings in efi_tpm_eventlog_init() to check for
   an empty main event log and a populated final event log, as shown
   below
4) Boot the resulting kernel build, look for the warnings, and report
   back

diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
index c1955d320fec..c4d2dbd5ed42 100644
--- a/drivers/firmware/efi/tpm.c
+++ b/drivers/firmware/efi/tpm.c
@@ -78,6 +78,9 @@ int __init efi_tpm_eventlog_init(void)
 		goto out;
 	}
 
+	WARN(!log_tbl->size && final_tbl->nr_events,
+	     "nr_events = %llu\n", final_tbl->nr_events);
+
 	tbl_size = 0;
 	if (final_tbl->nr_events != 0) {
 		void *events = (void *)efi.tpm_final_log
@@ -95,6 +98,8 @@ int __init efi_tpm_eventlog_init(void)
 		goto out_calc;
 	}
 
+	WARN(!log_tbl->size && tbl_size, "tbl_size = %d\n", tbl_size);
+
 	memblock_reserve((unsigned long)final_tbl,
 			 tbl_size + sizeof(*final_tbl));
 	efi_tpm_final_log_size = tbl_size;

For your convenience, I've created a branch with these changes on top of
v5.9:

 https://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/linux.git/log/?h=tpm/bin-bios-measurements-debug

Thank you!

Tyler

  reply	other threads:[~2020-10-28 22:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 12:31 [Regression] "tpm: Require that all digests are present in TCG_PCR_EVENT2 structures" causes null pointer dereference Kai-Heng Feng
2020-09-28 14:06 ` Jarkko Sakkinen
2020-09-28 14:16   ` Kai-Heng Feng
     [not found]     ` <20200928155215.GA92669@linux.intel.com>
2020-09-28 16:15       ` Ard Biesheuvel
2020-09-28 16:26         ` Ard Biesheuvel
2020-09-28 17:12         ` Jarkko Sakkinen
2020-09-28 18:05           ` Kenneth R. Crudup
2020-09-29 17:52     ` Mimi Zohar
2020-09-30  2:20       ` Jarkko Sakkinen
2020-10-08  9:09         ` Kai-Heng Feng
2020-10-09 16:06           ` Jarkko Sakkinen
2020-10-13 14:31             ` Tyler Hicks
2020-10-13 14:33               ` Jarkko Sakkinen
2020-10-20 21:07       ` Mimi Zohar
2020-10-21  5:48         ` Tyler Hicks
2020-10-26  5:49           ` Kai-Heng Feng
2020-10-27  5:08             ` Tyler Hicks
2020-10-28 15:41 ` [PATCH] tpm: efi: Don't create binary_bios_measurements file for an empty log Tyler Hicks
2020-10-28 16:30   ` Tyler Hicks
2020-10-28 17:39     ` Tyler Hicks [this message]
2020-10-30  6:41       ` Kai-Heng Feng
2020-11-04  2:12       ` Kenneth R. Crudup
2020-10-30  4:46   ` Jarkko Sakkinen

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=20201028173958.GA4624@sequoia \
    --to=tyhicks@linux.microsoft.com \
    --cc=ardb@kernel.org \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=kai.heng.feng@canonical.com \
    --cc=kenny@panix.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=tweek@google.com \
    --cc=zohar@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.