linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/2] Abstract out support for locating an EFI config table
@ 2019-06-07 20:51 Matthew Garrett
  2019-06-07 20:51 ` [PATCH V2 2/2] tpm: Don't duplicate events from the final event log in the TCG2 log Matthew Garrett
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Matthew Garrett @ 2019-06-07 20:51 UTC (permalink / raw)
  To: linux-integrity
  Cc: peterhuewe, jarkko.sakkinen, jgg, linux-efi, ard.biesheuvel,
	Matthew Garrett, Matthew Garrett

We want to grab a pointer to the TPM final events table, so abstract out
the existing code for finding an FDT table and make it generic.

Signed-off-by: Matthew Garrett <mjg59@google.com>
---
 .../firmware/efi/libstub/efi-stub-helper.c    | 15 +++++++++++
 drivers/firmware/efi/libstub/efistub.h        |  2 ++
 drivers/firmware/efi/libstub/fdt.c            | 27 +++++++------------
 3 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index e4610e72b78f..1db780c0f07b 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -926,3 +926,18 @@ efi_status_t efi_exit_boot_services(efi_system_table_t *sys_table_arg,
 fail:
 	return status;
 }
+
+void *get_efi_config_table(efi_system_table_t *sys_table, efi_guid_t guid)
+{
+	efi_config_table_t *tables = (efi_config_table_t *)sys_table->tables;
+	int i;
+
+	for (i = 0; i < sys_table->nr_tables; i++) {
+		if (efi_guidcmp(tables[i].guid, guid) != 0)
+			continue;
+
+		return (void *)tables[i].table;
+	}
+
+	return NULL;
+}
diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
index 1b1dfcaa6fb9..7f1556fd867d 100644
--- a/drivers/firmware/efi/libstub/efistub.h
+++ b/drivers/firmware/efi/libstub/efistub.h
@@ -65,6 +65,8 @@ efi_status_t check_platform_features(efi_system_table_t *sys_table_arg);
 
 efi_status_t efi_random_get_seed(efi_system_table_t *sys_table_arg);
 
+void *get_efi_config_table(efi_system_table_t *sys_table, efi_guid_t guid);
+
 /* Helper macros for the usual case of using simple C variables: */
 #ifndef fdt_setprop_inplace_var
 #define fdt_setprop_inplace_var(fdt, node_offset, name, var) \
diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c
index 5440ba17a1c5..0bf0190917e0 100644
--- a/drivers/firmware/efi/libstub/fdt.c
+++ b/drivers/firmware/efi/libstub/fdt.c
@@ -363,26 +363,17 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table,
 
 void *get_fdt(efi_system_table_t *sys_table, unsigned long *fdt_size)
 {
-	efi_guid_t fdt_guid = DEVICE_TREE_GUID;
-	efi_config_table_t *tables;
-	int i;
+	void *fdt;
 
-	tables = (efi_config_table_t *)sys_table->tables;
+	fdt = get_efi_config_table(sys_table, DEVICE_TREE_GUID);
 
-	for (i = 0; i < sys_table->nr_tables; i++) {
-		void *fdt;
+	if (!fdt)
+		return NULL;
 
-		if (efi_guidcmp(tables[i].guid, fdt_guid) != 0)
-			continue;
-
-		fdt = (void *)tables[i].table;
-		if (fdt_check_header(fdt) != 0) {
-			pr_efi_err(sys_table, "Invalid header detected on UEFI supplied FDT, ignoring ...\n");
-			return NULL;
-		}
-		*fdt_size = fdt_totalsize(fdt);
-		return fdt;
+	if (fdt_check_header(fdt) != 0) {
+		pr_efi_err(sys_table, "Invalid header detected on UEFI supplied FDT, ignoring ...\n");
+		return NULL;
 	}
-
-	return NULL;
+	*fdt_size = fdt_totalsize(fdt);
+	return fdt;
 }
-- 
2.22.0.rc2.383.gf4fbbf30c2-goog


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

* [PATCH V2 2/2] tpm: Don't duplicate events from the final event log in the TCG2 log
  2019-06-07 20:51 [PATCH V2 1/2] Abstract out support for locating an EFI config table Matthew Garrett
@ 2019-06-07 20:51 ` Matthew Garrett
  2019-06-07 21:11   ` Ard Biesheuvel
  2019-06-13 14:04   ` Jarkko Sakkinen
  2019-06-07 21:10 ` [PATCH V2 1/2] Abstract out support for locating an EFI config table Ard Biesheuvel
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 11+ messages in thread
From: Matthew Garrett @ 2019-06-07 20:51 UTC (permalink / raw)
  To: linux-integrity
  Cc: peterhuewe, jarkko.sakkinen, jgg, linux-efi, ard.biesheuvel,
	Matthew Garrett, Matthew Garrett, Joe Richey

After the first call to GetEventLog() on UEFI systems using the TCG2
crypto agile log format, any further log events (other than those
triggered by ExitBootServices()) will be logged in both the main log and
also in the Final Events Log. While the kernel only calls GetEventLog()
immediately before ExitBootServices(), we can't control whether earlier
parts of the boot process have done so. This will result in log entries
that exist in both logs, and so the current approach of simply appending
the Final Event Log to the main log will result in events being
duplicated.

We can avoid this problem by looking at the size of the Final Event Log
just before we call ExitBootServices() and exporting this to the main
kernel. The kernel can then skip over all events that occured before
ExitBootServices() and only append events that were not also logged to
the main log.

Signed-off-by: Matthew Garrett <mjg59@google.com>
Reported-by: Joe Richey <joerichey@google.com>
Suggested-by: Joe Richey <joerichey@google.com>
---
 drivers/char/tpm/eventlog/efi.c    | 11 ++++++++++-
 drivers/firmware/efi/libstub/tpm.c | 30 ++++++++++++++++++++++++++++++
 drivers/firmware/efi/tpm.c         |  2 +-
 include/linux/efi.h                |  1 +
 4 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/eventlog/efi.c b/drivers/char/tpm/eventlog/efi.c
index 9179cf6bdee9..be6540f2cb3d 100644
--- a/drivers/char/tpm/eventlog/efi.c
+++ b/drivers/char/tpm/eventlog/efi.c
@@ -80,6 +80,8 @@ int tpm_read_log_efi(struct tpm_chip *chip)
 		goto out;
 	}
 
+	efi_tpm_final_log_size -= log_tbl->final_events_preboot_size;
+
 	tmp = krealloc(log->bios_event_log,
 		       log_size + efi_tpm_final_log_size,
 		       GFP_KERNEL);
@@ -90,8 +92,15 @@ int tpm_read_log_efi(struct tpm_chip *chip)
 	}
 
 	log->bios_event_log = tmp;
+
+	/*
+	 * Copy any of the final events log that didn't also end up in the
+	 * main log. Events can be logged in both if events are generated
+	 * between GetEventLog() and ExitBootServices().
+	 */
 	memcpy((void *)log->bios_event_log + log_size,
-	       final_tbl->events, efi_tpm_final_log_size);
+	       final_tbl->events + log_tbl->final_events_preboot_size,
+	       efi_tpm_final_log_size);
 	log->bios_event_log_end = log->bios_event_log +
 		log_size + efi_tpm_final_log_size;
 
diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c
index 6b3b507a54eb..eb9af83e4d59 100644
--- a/drivers/firmware/efi/libstub/tpm.c
+++ b/drivers/firmware/efi/libstub/tpm.c
@@ -64,11 +64,13 @@ void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table_arg)
 	efi_status_t status;
 	efi_physical_addr_t log_location = 0, log_last_entry = 0;
 	struct linux_efi_tpm_eventlog *log_tbl = NULL;
+	struct efi_tcg2_final_events_table *final_events_table;
 	unsigned long first_entry_addr, last_entry_addr;
 	size_t log_size, last_entry_size;
 	efi_bool_t truncated;
 	int version = EFI_TCG2_EVENT_LOG_FORMAT_TCG_2;
 	void *tcg2_protocol = NULL;
+	int final_events_size = 0;
 
 	status = efi_call_early(locate_protocol, &tcg2_guid, NULL,
 				&tcg2_protocol);
@@ -134,8 +136,36 @@ void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table_arg)
 		return;
 	}
 
+	/*
+	 * Figure out whether any events have already been logged to the
+	 * final events structure, and if so how much space they take up
+	 */
+	final_events_table = get_efi_config_table(sys_table_arg,
+						LINUX_EFI_TPM_FINAL_LOG_GUID);
+	if (final_events_table && final_events_table->nr_events) {
+		struct tcg_pcr_event2_head *header;
+		int offset;
+		void *data;
+		int event_size;
+		int i = final_events_table->nr_events;
+
+		data = (void *)final_events_table;
+		offset = sizeof(final_events_table->version) +
+			sizeof(final_events_table->nr_events);
+
+		while (i > 0) {
+			header = data + offset + final_events_size;
+			event_size = __calc_tpm2_event_size(header,
+						   (void *)(long)log_location,
+						   false);
+			final_events_size += event_size;
+			i--;
+		}
+	}
+
 	memset(log_tbl, 0, sizeof(*log_tbl) + log_size);
 	log_tbl->size = log_size;
+	log_tbl->final_events_preboot_size = final_events_size;
 	log_tbl->version = version;
 	memcpy(log_tbl->log, (void *) first_entry_addr, log_size);
 
diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
index 2c912ea08166..0bdceb5913aa 100644
--- a/drivers/firmware/efi/tpm.c
+++ b/drivers/firmware/efi/tpm.c
@@ -76,7 +76,7 @@ int __init efi_tpm_eventlog_init(void)
 		goto out;
 	}
 
-	tbl_size = tpm2_calc_event_log_size(efi.tpm_final_log
+	tbl_size = tpm2_calc_event_log_size((void *)efi.tpm_final_log
 					    + sizeof(final_tbl->version)
 					    + sizeof(final_tbl->nr_events),
 					    final_tbl->nr_events,
diff --git a/include/linux/efi.h b/include/linux/efi.h
index e33c70a52a9d..2a26004a9bdb 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1703,6 +1703,7 @@ struct linux_efi_random_seed {
 
 struct linux_efi_tpm_eventlog {
 	u32	size;
+	u32	final_events_preboot_size;
 	u8	version;
 	u8	log[];
 };
-- 
2.22.0.rc2.383.gf4fbbf30c2-goog


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

* Re: [PATCH V2 1/2] Abstract out support for locating an EFI config table
  2019-06-07 20:51 [PATCH V2 1/2] Abstract out support for locating an EFI config table Matthew Garrett
  2019-06-07 20:51 ` [PATCH V2 2/2] tpm: Don't duplicate events from the final event log in the TCG2 log Matthew Garrett
@ 2019-06-07 21:10 ` Ard Biesheuvel
  2019-06-10 16:58 ` Jarkko Sakkinen
  2019-06-13 14:02 ` Jarkko Sakkinen
  3 siblings, 0 replies; 11+ messages in thread
From: Ard Biesheuvel @ 2019-06-07 21:10 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: linux-integrity, Peter Hüwe, Jarkko Sakkinen,
	Jason Gunthorpe, linux-efi, Matthew Garrett

On Fri, 7 Jun 2019 at 22:52, Matthew Garrett <matthewgarrett@google.com> wrote:
>
> We want to grab a pointer to the TPM final events table, so abstract out
> the existing code for finding an FDT table and make it generic.
>
> Signed-off-by: Matthew Garrett <mjg59@google.com>
> ---
>  .../firmware/efi/libstub/efi-stub-helper.c    | 15 +++++++++++
>  drivers/firmware/efi/libstub/efistub.h        |  2 ++
>  drivers/firmware/efi/libstub/fdt.c            | 27 +++++++------------
>  3 files changed, 26 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
> index e4610e72b78f..1db780c0f07b 100644
> --- a/drivers/firmware/efi/libstub/efi-stub-helper.c
> +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
> @@ -926,3 +926,18 @@ efi_status_t efi_exit_boot_services(efi_system_table_t *sys_table_arg,
>  fail:
>         return status;
>  }
> +
> +void *get_efi_config_table(efi_system_table_t *sys_table, efi_guid_t guid)
> +{
> +       efi_config_table_t *tables = (efi_config_table_t *)sys_table->tables;
> +       int i;
> +
> +       for (i = 0; i < sys_table->nr_tables; i++) {
> +               if (efi_guidcmp(tables[i].guid, guid) != 0)
> +                       continue;
> +
> +               return (void *)tables[i].table;
> +       }
> +
> +       return NULL;
> +}
> diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
> index 1b1dfcaa6fb9..7f1556fd867d 100644
> --- a/drivers/firmware/efi/libstub/efistub.h
> +++ b/drivers/firmware/efi/libstub/efistub.h
> @@ -65,6 +65,8 @@ efi_status_t check_platform_features(efi_system_table_t *sys_table_arg);
>
>  efi_status_t efi_random_get_seed(efi_system_table_t *sys_table_arg);
>
> +void *get_efi_config_table(efi_system_table_t *sys_table, efi_guid_t guid);
> +
>  /* Helper macros for the usual case of using simple C variables: */
>  #ifndef fdt_setprop_inplace_var
>  #define fdt_setprop_inplace_var(fdt, node_offset, name, var) \
> diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c
> index 5440ba17a1c5..0bf0190917e0 100644
> --- a/drivers/firmware/efi/libstub/fdt.c
> +++ b/drivers/firmware/efi/libstub/fdt.c
> @@ -363,26 +363,17 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table,
>
>  void *get_fdt(efi_system_table_t *sys_table, unsigned long *fdt_size)
>  {
> -       efi_guid_t fdt_guid = DEVICE_TREE_GUID;
> -       efi_config_table_t *tables;
> -       int i;
> +       void *fdt;
>
> -       tables = (efi_config_table_t *)sys_table->tables;
> +       fdt = get_efi_config_table(sys_table, DEVICE_TREE_GUID);
>
> -       for (i = 0; i < sys_table->nr_tables; i++) {
> -               void *fdt;
> +       if (!fdt)
> +               return NULL;
>
> -               if (efi_guidcmp(tables[i].guid, fdt_guid) != 0)
> -                       continue;
> -
> -               fdt = (void *)tables[i].table;
> -               if (fdt_check_header(fdt) != 0) {
> -                       pr_efi_err(sys_table, "Invalid header detected on UEFI supplied FDT, ignoring ...\n");
> -                       return NULL;
> -               }
> -               *fdt_size = fdt_totalsize(fdt);
> -               return fdt;
> +       if (fdt_check_header(fdt) != 0) {
> +               pr_efi_err(sys_table, "Invalid header detected on UEFI supplied FDT, ignoring ...\n");
> +               return NULL;
>         }
> -
> -       return NULL;
> +       *fdt_size = fdt_totalsize(fdt);
> +       return fdt;
>  }

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

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

* Re: [PATCH V2 2/2] tpm: Don't duplicate events from the final event log in the TCG2 log
  2019-06-07 20:51 ` [PATCH V2 2/2] tpm: Don't duplicate events from the final event log in the TCG2 log Matthew Garrett
@ 2019-06-07 21:11   ` Ard Biesheuvel
  2019-06-13 14:06     ` Jarkko Sakkinen
  2019-06-13 14:04   ` Jarkko Sakkinen
  1 sibling, 1 reply; 11+ messages in thread
From: Ard Biesheuvel @ 2019-06-07 21:11 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: linux-integrity, Peter Hüwe, Jarkko Sakkinen,
	Jason Gunthorpe, linux-efi, Matthew Garrett, Joe Richey

On Fri, 7 Jun 2019 at 22:52, Matthew Garrett <matthewgarrett@google.com> wrote:
>
> After the first call to GetEventLog() on UEFI systems using the TCG2
> crypto agile log format, any further log events (other than those
> triggered by ExitBootServices()) will be logged in both the main log and
> also in the Final Events Log. While the kernel only calls GetEventLog()
> immediately before ExitBootServices(), we can't control whether earlier
> parts of the boot process have done so. This will result in log entries
> that exist in both logs, and so the current approach of simply appending
> the Final Event Log to the main log will result in events being
> duplicated.
>
> We can avoid this problem by looking at the size of the Final Event Log
> just before we call ExitBootServices() and exporting this to the main
> kernel. The kernel can then skip over all events that occured before
> ExitBootServices() and only append events that were not also logged to
> the main log.
>
> Signed-off-by: Matthew Garrett <mjg59@google.com>
> Reported-by: Joe Richey <joerichey@google.com>
> Suggested-by: Joe Richey <joerichey@google.com>
> ---
>  drivers/char/tpm/eventlog/efi.c    | 11 ++++++++++-
>  drivers/firmware/efi/libstub/tpm.c | 30 ++++++++++++++++++++++++++++++
>  drivers/firmware/efi/tpm.c         |  2 +-
>  include/linux/efi.h                |  1 +
>  4 files changed, 42 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/eventlog/efi.c b/drivers/char/tpm/eventlog/efi.c
> index 9179cf6bdee9..be6540f2cb3d 100644
> --- a/drivers/char/tpm/eventlog/efi.c
> +++ b/drivers/char/tpm/eventlog/efi.c
> @@ -80,6 +80,8 @@ int tpm_read_log_efi(struct tpm_chip *chip)
>                 goto out;
>         }
>
> +       efi_tpm_final_log_size -= log_tbl->final_events_preboot_size;
> +
>         tmp = krealloc(log->bios_event_log,
>                        log_size + efi_tpm_final_log_size,
>                        GFP_KERNEL);
> @@ -90,8 +92,15 @@ int tpm_read_log_efi(struct tpm_chip *chip)
>         }
>
>         log->bios_event_log = tmp;
> +
> +       /*
> +        * Copy any of the final events log that didn't also end up in the
> +        * main log. Events can be logged in both if events are generated
> +        * between GetEventLog() and ExitBootServices().
> +        */
>         memcpy((void *)log->bios_event_log + log_size,
> -              final_tbl->events, efi_tpm_final_log_size);
> +              final_tbl->events + log_tbl->final_events_preboot_size,
> +              efi_tpm_final_log_size);
>         log->bios_event_log_end = log->bios_event_log +
>                 log_size + efi_tpm_final_log_size;
>
> diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c
> index 6b3b507a54eb..eb9af83e4d59 100644
> --- a/drivers/firmware/efi/libstub/tpm.c
> +++ b/drivers/firmware/efi/libstub/tpm.c
> @@ -64,11 +64,13 @@ void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table_arg)
>         efi_status_t status;
>         efi_physical_addr_t log_location = 0, log_last_entry = 0;
>         struct linux_efi_tpm_eventlog *log_tbl = NULL;
> +       struct efi_tcg2_final_events_table *final_events_table;
>         unsigned long first_entry_addr, last_entry_addr;
>         size_t log_size, last_entry_size;
>         efi_bool_t truncated;
>         int version = EFI_TCG2_EVENT_LOG_FORMAT_TCG_2;
>         void *tcg2_protocol = NULL;
> +       int final_events_size = 0;
>
>         status = efi_call_early(locate_protocol, &tcg2_guid, NULL,
>                                 &tcg2_protocol);
> @@ -134,8 +136,36 @@ void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table_arg)
>                 return;
>         }
>
> +       /*
> +        * Figure out whether any events have already been logged to the
> +        * final events structure, and if so how much space they take up
> +        */
> +       final_events_table = get_efi_config_table(sys_table_arg,
> +                                               LINUX_EFI_TPM_FINAL_LOG_GUID);
> +       if (final_events_table && final_events_table->nr_events) {
> +               struct tcg_pcr_event2_head *header;
> +               int offset;
> +               void *data;
> +               int event_size;
> +               int i = final_events_table->nr_events;
> +
> +               data = (void *)final_events_table;
> +               offset = sizeof(final_events_table->version) +
> +                       sizeof(final_events_table->nr_events);
> +
> +               while (i > 0) {
> +                       header = data + offset + final_events_size;
> +                       event_size = __calc_tpm2_event_size(header,
> +                                                  (void *)(long)log_location,
> +                                                  false);
> +                       final_events_size += event_size;
> +                       i--;
> +               }
> +       }
> +
>         memset(log_tbl, 0, sizeof(*log_tbl) + log_size);
>         log_tbl->size = log_size;
> +       log_tbl->final_events_preboot_size = final_events_size;
>         log_tbl->version = version;
>         memcpy(log_tbl->log, (void *) first_entry_addr, log_size);
>
> diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
> index 2c912ea08166..0bdceb5913aa 100644
> --- a/drivers/firmware/efi/tpm.c
> +++ b/drivers/firmware/efi/tpm.c
> @@ -76,7 +76,7 @@ int __init efi_tpm_eventlog_init(void)
>                 goto out;
>         }
>
> -       tbl_size = tpm2_calc_event_log_size(efi.tpm_final_log
> +       tbl_size = tpm2_calc_event_log_size((void *)efi.tpm_final_log
>                                             + sizeof(final_tbl->version)
>                                             + sizeof(final_tbl->nr_events),
>                                             final_tbl->nr_events,
> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index e33c70a52a9d..2a26004a9bdb 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -1703,6 +1703,7 @@ struct linux_efi_random_seed {
>
>  struct linux_efi_tpm_eventlog {
>         u32     size;
> +       u32     final_events_preboot_size;
>         u8      version;
>         u8      log[];
>  };

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

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

* Re: [PATCH V2 1/2] Abstract out support for locating an EFI config table
  2019-06-07 20:51 [PATCH V2 1/2] Abstract out support for locating an EFI config table Matthew Garrett
  2019-06-07 20:51 ` [PATCH V2 2/2] tpm: Don't duplicate events from the final event log in the TCG2 log Matthew Garrett
  2019-06-07 21:10 ` [PATCH V2 1/2] Abstract out support for locating an EFI config table Ard Biesheuvel
@ 2019-06-10 16:58 ` Jarkko Sakkinen
  2019-06-10 17:46   ` Matthew Garrett
  2019-06-13 14:02 ` Jarkko Sakkinen
  3 siblings, 1 reply; 11+ messages in thread
From: Jarkko Sakkinen @ 2019-06-10 16:58 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: linux-integrity, peterhuewe, jgg, linux-efi, ard.biesheuvel,
	Matthew Garrett

On Fri, Jun 07, 2019 at 01:51:46PM -0700, Matthew Garrett wrote:
> We want to grab a pointer to the TPM final events table, so abstract out
> the existing code for finding an FDT table and make it generic.
> 
> Signed-off-by: Matthew Garrett <mjg59@google.com>

Just to clarify are these extensions to what you did before and not
something that needs be squashed your commits pipelined for v5.3?

/Jarkko

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

* Re: [PATCH V2 1/2] Abstract out support for locating an EFI config table
  2019-06-10 16:58 ` Jarkko Sakkinen
@ 2019-06-10 17:46   ` Matthew Garrett
  2019-06-12 19:15     ` Jarkko Sakkinen
  0 siblings, 1 reply; 11+ messages in thread
From: Matthew Garrett @ 2019-06-10 17:46 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: linux-integrity, Peter Huewe, Jason Gunthorpe, linux-efi, Ard Biesheuvel

On Mon, Jun 10, 2019 at 9:58 AM Jarkko Sakkinen
<jarkko.sakkinen@linux.intel.com> wrote:
>
> On Fri, Jun 07, 2019 at 01:51:46PM -0700, Matthew Garrett wrote:
> > We want to grab a pointer to the TPM final events table, so abstract out
> > the existing code for finding an FDT table and make it generic.
> >
> > Signed-off-by: Matthew Garrett <mjg59@google.com>
>
> Just to clarify are these extensions to what you did before and not
> something that needs be squashed your commits pipelined for v5.3?

Correct - they handle a corner case. Ideally they'd hit 5.3 as well,
but if you'd prefer I'm ok waiting.

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

* Re: [PATCH V2 1/2] Abstract out support for locating an EFI config table
  2019-06-10 17:46   ` Matthew Garrett
@ 2019-06-12 19:15     ` Jarkko Sakkinen
  0 siblings, 0 replies; 11+ messages in thread
From: Jarkko Sakkinen @ 2019-06-12 19:15 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: linux-integrity, Peter Huewe, Jason Gunthorpe, linux-efi, Ard Biesheuvel

On Mon, Jun 10, 2019 at 10:46:35AM -0700, Matthew Garrett wrote:
> On Mon, Jun 10, 2019 at 9:58 AM Jarkko Sakkinen
> <jarkko.sakkinen@linux.intel.com> wrote:
> >
> > On Fri, Jun 07, 2019 at 01:51:46PM -0700, Matthew Garrett wrote:
> > > We want to grab a pointer to the TPM final events table, so abstract out
> > > the existing code for finding an FDT table and make it generic.
> > >
> > > Signed-off-by: Matthew Garrett <mjg59@google.com>
> >
> > Just to clarify are these extensions to what you did before and not
> > something that needs be squashed your commits pipelined for v5.3?
> 
> Correct - they handle a corner case. Ideally they'd hit 5.3 as well,
> but if you'd prefer I'm ok waiting.

Probably makes sense to have them in the PR.

/Jarkko

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

* Re: [PATCH V2 1/2] Abstract out support for locating an EFI config table
  2019-06-07 20:51 [PATCH V2 1/2] Abstract out support for locating an EFI config table Matthew Garrett
                   ` (2 preceding siblings ...)
  2019-06-10 16:58 ` Jarkko Sakkinen
@ 2019-06-13 14:02 ` Jarkko Sakkinen
  3 siblings, 0 replies; 11+ messages in thread
From: Jarkko Sakkinen @ 2019-06-13 14:02 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: linux-integrity, peterhuewe, jgg, linux-efi, ard.biesheuvel,
	Matthew Garrett

On Fri, Jun 07, 2019 at 01:51:46PM -0700, Matthew Garrett wrote:
> We want to grab a pointer to the TPM final events table, so abstract out
> the existing code for finding an FDT table and make it generic.
> 
> Signed-off-by: Matthew Garrett <mjg59@google.com>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

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

* Re: [PATCH V2 2/2] tpm: Don't duplicate events from the final event log in the TCG2 log
  2019-06-07 20:51 ` [PATCH V2 2/2] tpm: Don't duplicate events from the final event log in the TCG2 log Matthew Garrett
  2019-06-07 21:11   ` Ard Biesheuvel
@ 2019-06-13 14:04   ` Jarkko Sakkinen
  1 sibling, 0 replies; 11+ messages in thread
From: Jarkko Sakkinen @ 2019-06-13 14:04 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: linux-integrity, peterhuewe, jgg, linux-efi, ard.biesheuvel,
	Matthew Garrett, Joe Richey

On Fri, Jun 07, 2019 at 01:51:47PM -0700, Matthew Garrett wrote:
> After the first call to GetEventLog() on UEFI systems using the TCG2
> crypto agile log format, any further log events (other than those
> triggered by ExitBootServices()) will be logged in both the main log and
> also in the Final Events Log. While the kernel only calls GetEventLog()
> immediately before ExitBootServices(), we can't control whether earlier
> parts of the boot process have done so. This will result in log entries
> that exist in both logs, and so the current approach of simply appending
> the Final Event Log to the main log will result in events being
> duplicated.
> 
> We can avoid this problem by looking at the size of the Final Event Log
> just before we call ExitBootServices() and exporting this to the main
> kernel. The kernel can then skip over all events that occured before
> ExitBootServices() and only append events that were not also logged to
> the main log.
> 
> Signed-off-by: Matthew Garrett <mjg59@google.com>
> Reported-by: Joe Richey <joerichey@google.com>
> Suggested-by: Joe Richey <joerichey@google.com>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

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

* Re: [PATCH V2 2/2] tpm: Don't duplicate events from the final event log in the TCG2 log
  2019-06-07 21:11   ` Ard Biesheuvel
@ 2019-06-13 14:06     ` Jarkko Sakkinen
  2019-06-13 14:23       ` Ard Biesheuvel
  0 siblings, 1 reply; 11+ messages in thread
From: Jarkko Sakkinen @ 2019-06-13 14:06 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Matthew Garrett, linux-integrity, Peter Hüwe,
	Jason Gunthorpe, linux-efi, Matthew Garrett, Joe Richey

On Fri, Jun 07, 2019 at 11:11:21PM +0200, Ard Biesheuvel wrote:
> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Ard, is it cool if I include these to my next TPM PR along with the
other Matthew's changes? Just sanity checking given that crossing
subsystems...

/Jarkko

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

* Re: [PATCH V2 2/2] tpm: Don't duplicate events from the final event log in the TCG2 log
  2019-06-13 14:06     ` Jarkko Sakkinen
@ 2019-06-13 14:23       ` Ard Biesheuvel
  0 siblings, 0 replies; 11+ messages in thread
From: Ard Biesheuvel @ 2019-06-13 14:23 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Matthew Garrett, linux-integrity, Peter Hüwe,
	Jason Gunthorpe, linux-efi, Matthew Garrett, Joe Richey

On Thu, 13 Jun 2019 at 16:06, Jarkko Sakkinen
<jarkko.sakkinen@linux.intel.com> wrote:
>
> On Fri, Jun 07, 2019 at 11:11:21PM +0200, Ard Biesheuvel wrote:
> > Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> Ard, is it cool if I include these to my next TPM PR along with the
> other Matthew's changes? Just sanity checking given that crossing
> subsystems...
>

Yes, that is fine.

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

end of thread, other threads:[~2019-06-13 15:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-07 20:51 [PATCH V2 1/2] Abstract out support for locating an EFI config table Matthew Garrett
2019-06-07 20:51 ` [PATCH V2 2/2] tpm: Don't duplicate events from the final event log in the TCG2 log Matthew Garrett
2019-06-07 21:11   ` Ard Biesheuvel
2019-06-13 14:06     ` Jarkko Sakkinen
2019-06-13 14:23       ` Ard Biesheuvel
2019-06-13 14:04   ` Jarkko Sakkinen
2019-06-07 21:10 ` [PATCH V2 1/2] Abstract out support for locating an EFI config table Ard Biesheuvel
2019-06-10 16:58 ` Jarkko Sakkinen
2019-06-10 17:46   ` Matthew Garrett
2019-06-12 19:15     ` Jarkko Sakkinen
2019-06-13 14:02 ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).