All of lore.kernel.org
 help / color / mirror / Atom feed
* Regression from efi: call get_event_log before ExitBootServices
@ 2018-03-06 16:00 Jeremy Cline
  2018-03-07  8:41   ` Thiebaud Weksteen via tpmdd-devel
       [not found] ` <e7c2be5c-cf21-fc2d-efda-d9222d93ffad@redhat.com>
  0 siblings, 2 replies; 44+ messages in thread
From: Jeremy Cline @ 2018-03-06 16:00 UTC (permalink / raw)
  To: Thiebaud Weksteen, Javier Martinez Canillas, Jarkko Sakkinen
  Cc: Hans de Goede, linux-efi, linux-integrity, tpmdd-devel, linux-kernel

Hi folks,

Commit 33b6d03469b2 ("efi: call get_event_log before ExitBootServices")
causes my GP-electronic T701 tablet to hang when booting. Reverting the
patch series or hiding the TPM in the BIOS fixes the problem.

I've never fiddled with TPMs before so I'm not sure what what debugging
information to provide. It's got an Atom Z3735G and the UEFI firmware is
InsydeH20 version BYT70A.YNCHENG.WIN.007.


Regards,
Jeremy

^ permalink raw reply	[flat|nested] 44+ messages in thread
* Re: Regression from efi: call get_event_log before ExitBootServices
@ 2018-03-08 10:03 Thiebaud Weksteen
  0 siblings, 0 replies; 44+ messages in thread
From: Thiebaud Weksteen @ 2018-03-08 10:03 UTC (permalink / raw)
  To: Jeremy Cline
  Cc: Javier Martinez Canillas, Jarkko Sakkinen, hdegoede, linux-efi,
	linux-integrity, linux-kernel, Thiebaud Weksteen

---
 drivers/firmware/efi/libstub/tpm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c
index da661bf8cb96..773afcd6a37c 100644
--- a/drivers/firmware/efi/libstub/tpm.c
+++ b/drivers/firmware/efi/libstub/tpm.c
@@ -74,19 +74,23 @@ void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg)
 	efi_bool_t truncated;
 	void *tcg2_protocol;
 
+	efi_printk(sys_table_arg, "Locating the TCG2Protocol\n");
 	status = efi_call_early(locate_protocol, &tcg2_guid, NULL,
 				&tcg2_protocol);
 	if (status != EFI_SUCCESS)
 		return;
 
+	efi_printk(sys_table_arg, "Calling GetEventLog on TCG2Protocol\n");
 	status = efi_call_proto(efi_tcg2_protocol, get_event_log, tcg2_protocol,
 				EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2,
 				&log_location, &log_last_entry, &truncated);
 	if (status != EFI_SUCCESS)
 		return;
+	efi_printk(sys_table_arg, "Log returned\n");
 
 	if (!log_location)
 		return;
+	efi_printk(sys_table_arg, "log_location is not empty\n");
 	first_entry_addr = (unsigned long) log_location;
 
 	/*
@@ -94,7 +98,9 @@ void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg)
 	 */
 	if (!log_last_entry) {
 		log_size = 0;
+		efi_printk(sys_table_arg, "log_size = 0\n");
 	} else {
+		efi_printk(sys_table_arg, "log_size != 0\n");
 		last_entry_addr = (unsigned long) log_last_entry;
 		/*
 		 * get_event_log only returns the address of the last entry.
@@ -106,26 +112,31 @@ void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg)
 		log_size = log_last_entry - log_location + last_entry_size;
 	}
 
+	efi_printk(sys_table_arg, "Allocating memory for storing the logs\n");
 	/* Allocate space for the logs and copy them. */
 	status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
 				sizeof(*log_tbl) + log_size,
 				(void **) &log_tbl);
 
+	efi_printk(sys_table_arg, "Returned from memory allocation\n");
 	if (status != EFI_SUCCESS) {
 		efi_printk(sys_table_arg,
 			   "Unable to allocate memory for event log\n");
 		return;
 	}
+	efi_printk(sys_table_arg, "Copying log to new location\n");
 
 	memset(log_tbl, 0, sizeof(*log_tbl) + log_size);
 	log_tbl->size = log_size;
 	log_tbl->version = EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2;
 	memcpy(log_tbl->log, (void *) first_entry_addr, log_size);
 
+	efi_printk(sys_table_arg, "Installing the log into the configuration table\n");
 	status = efi_call_early(install_configuration_table,
 				&linux_eventlog_guid, log_tbl);
 	if (status != EFI_SUCCESS)
 		goto err_free;
+	efi_printk(sys_table_arg, "Done\n");
 	return;
 
 err_free:
-- 
2.16.2.395.g2e18187dfd-goog

^ permalink raw reply related	[flat|nested] 44+ messages in thread
* Re: Regression from efi: call get_event_log before ExitBootServices
@ 2018-03-09 10:50 Thiebaud Weksteen
  0 siblings, 0 replies; 44+ messages in thread
From: Thiebaud Weksteen @ 2018-03-09 10:50 UTC (permalink / raw)
  To: Jeremy Cline
  Cc: Javier Martinez Canillas, Jarkko Sakkinen, hdegoede, linux-efi,
	linux-integrity, linux-kernel, Thiebaud Weksteen

---
 drivers/firmware/efi/libstub/tpm.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c
index 773afcd6a37c..ee3fac109078 100644
--- a/drivers/firmware/efi/libstub/tpm.c
+++ b/drivers/firmware/efi/libstub/tpm.c
@@ -112,6 +112,22 @@ void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg)
 		log_size = log_last_entry - log_location + last_entry_size;
 	}
 
+	if (log_size == 0) {
+		efi_printk(sys_table_arg, "log_size == 0\n");
+	}
+	else if (log_size < 1 * 1024 * 1024) {
+		efi_printk(sys_table_arg, "log_size < 1M\n");
+	}
+	else if (log_size < 500 * 1024 * 1024) {
+		efi_printk(sys_table_arg, "log_size < 500M\n");
+	}
+	else if (log_size < 1000 * 1024 * 1024) {
+		efi_printk(sys_table_arg, "log_size < 1G\n");
+	}
+	else {
+		efi_printk(sys_table_arg, "log_size > 1G\n");
+	}
+
 	efi_printk(sys_table_arg, "Allocating memory for storing the logs\n");
 	/* Allocate space for the logs and copy them. */
 	status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
@@ -124,6 +140,11 @@ void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg)
 			   "Unable to allocate memory for event log\n");
 		return;
 	}
+	if (!log_tbl) {
+		efi_printk(sys_table_arg, "Pointer returned from allocation is NULL!\n");
+		return;
+	}
+
 	efi_printk(sys_table_arg, "Copying log to new location\n");
 
 	memset(log_tbl, 0, sizeof(*log_tbl) + log_size);
-- 
2.16.2.395.g2e18187dfd-goog

^ permalink raw reply related	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2018-03-16 13:02 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-06 16:00 Regression from efi: call get_event_log before ExitBootServices Jeremy Cline
2018-03-07  8:41 ` Thiebaud Weksteen
2018-03-07  8:41   ` Thiebaud Weksteen via tpmdd-devel
2018-03-07 11:16   ` Hans de Goede
2018-03-07 12:00     ` Javier Martinez Canillas
2018-03-07 17:33   ` Jeremy Cline
2018-03-08  8:45     ` Thiebaud Weksteen
2018-03-08 18:20       ` Jeremy Cline
     [not found] ` <e7c2be5c-cf21-fc2d-efda-d9222d93ffad@redhat.com>
     [not found]   ` <b32f335c-0d77-1749-f7fe-65f512280255@redhat.com>
     [not found]     ` <ade378f6-c997-1d48-a30d-cceee6435fc8@redhat.com>
     [not found]       ` <a3b5f822-f8f4-e2f5-46da-e23e13174f28@redhat.com>
2018-03-08 16:50         ` Hans de Goede
2018-03-08 17:26           ` Jeremy Cline
2018-03-09  9:29             ` Hans de Goede
2018-03-09 10:43               ` Thiebaud Weksteen
2018-03-09 16:54                 ` Jeremy Cline
2018-03-10 10:45                   ` Thiebaud Weksteen
2018-03-12 10:17                     ` Jarkko Sakkinen
2018-03-12 10:41                       ` Paul Menzel
2018-03-12 10:41                         ` Paul Menzel
2018-03-16 13:01                         ` Jarkko Sakkinen
2018-03-12 11:08                     ` Ard Biesheuvel
2018-03-12 14:30                       ` Jeremy Cline
2018-03-12 14:56                         ` Ard Biesheuvel
2018-03-12 14:56                           ` Ard Biesheuvel
2018-03-12 17:01                           ` Jeremy Cline
2018-03-12 17:30                             ` Ard Biesheuvel
2018-03-12 18:29                               ` Thiebaud Weksteen
2018-03-12 18:33                                 ` Jeremy Cline
2018-03-12 19:55                                   ` Thiebaud Weksteen
2018-03-12 21:02                                     ` Ard Biesheuvel
2018-03-13  7:24                                       ` Thiebaud Weksteen
2018-03-13  8:08                                       ` Hans de Goede
2018-03-13  1:50                                     ` Jeremy Cline
2018-03-13  7:47                                     ` Hans de Goede
2018-03-13  7:59                                       ` Ard Biesheuvel
2018-03-13  8:02                                         ` Ard Biesheuvel
2018-03-13 10:23                                         ` Thiebaud Weksteen
2018-03-13 10:30                                           ` Ard Biesheuvel
2018-03-13 13:41                                         ` Jeremy Cline
2018-03-13 13:43                                           ` Ard Biesheuvel
2018-03-13 15:00                                             ` Thiebaud Weksteen
2018-03-13 12:51                                       ` Andy Shevchenko
2018-03-12 18:30                               ` Jeremy Cline
2018-03-09 17:03               ` James Bottomley
2018-03-08 10:03 Thiebaud Weksteen
2018-03-09 10:50 Thiebaud Weksteen

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.