All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] efi_loader: fix BootOrder variable measurement handling
  2021-11-09  9:44 [PATCH] efi_loader: fix BootOrder variable measurement handling Masahisa Kojima
@ 2021-11-09  9:44 ` Ilias Apalodimas
  2021-11-09 11:00 ` Heinrich Schuchardt
  1 sibling, 0 replies; 3+ messages in thread
From: Ilias Apalodimas @ 2021-11-09  9:44 UTC (permalink / raw)
  To: Masahisa Kojima; +Cc: u-boot, Heinrich Schuchardt, Simon Glass, Alexander Graf

On Tue, 9 Nov 2021 at 11:42, Masahisa Kojima <masahisa.kojima@linaro.org>
wrote:

> UEFI specification does not require that BootOrder is defined.
> In current implementation, boot variable measurement fails and
> returns EFI_NOT_FOUND if BootOrder is not defined.
>
> This commit correcly handles this case, skip the boot variable
> measurement if BootOrder is not defined.
>
> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
> ---
>  lib/efi_loader/efi_tcg2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
> index 586f73af6d..189e4a5ba5 100644
> --- a/lib/efi_loader/efi_tcg2.c
> +++ b/lib/efi_loader/efi_tcg2.c
> @@ -1452,8 +1452,8 @@ static efi_status_t
> tcg2_measure_boot_variable(struct udevice *dev)
>         boot_order = efi_get_var(var_name, &efi_global_variable_guid,
>                                  &var_data_size);
>         if (!boot_order) {
> -               ret = EFI_NOT_FOUND;
> -               goto error;
> +               /* If "BootOrder" is not defined, skip the boot variable
> measurement */
> +               return EFI_SUCCESS;
>         }
>
>         ret = tcg2_measure_variable(dev, 1, EV_EFI_VARIABLE_BOOT2,
> var_name,
> --
> 2.17.1
>
> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

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

* [PATCH] efi_loader: fix BootOrder variable measurement handling
@ 2021-11-09  9:44 Masahisa Kojima
  2021-11-09  9:44 ` Ilias Apalodimas
  2021-11-09 11:00 ` Heinrich Schuchardt
  0 siblings, 2 replies; 3+ messages in thread
From: Masahisa Kojima @ 2021-11-09  9:44 UTC (permalink / raw)
  To: u-boot
  Cc: Heinrich Schuchardt, Ilias Apalodimas, Simon Glass,
	Masahisa Kojima, Alexander Graf

UEFI specification does not require that BootOrder is defined.
In current implementation, boot variable measurement fails and
returns EFI_NOT_FOUND if BootOrder is not defined.

This commit correcly handles this case, skip the boot variable
measurement if BootOrder is not defined.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
---
 lib/efi_loader/efi_tcg2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index 586f73af6d..189e4a5ba5 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -1452,8 +1452,8 @@ static efi_status_t tcg2_measure_boot_variable(struct udevice *dev)
 	boot_order = efi_get_var(var_name, &efi_global_variable_guid,
 				 &var_data_size);
 	if (!boot_order) {
-		ret = EFI_NOT_FOUND;
-		goto error;
+		/* If "BootOrder" is not defined, skip the boot variable measurement */
+		return EFI_SUCCESS;
 	}
 
 	ret = tcg2_measure_variable(dev, 1, EV_EFI_VARIABLE_BOOT2, var_name,
-- 
2.17.1


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

* Re: [PATCH] efi_loader: fix BootOrder variable measurement handling
  2021-11-09  9:44 [PATCH] efi_loader: fix BootOrder variable measurement handling Masahisa Kojima
  2021-11-09  9:44 ` Ilias Apalodimas
@ 2021-11-09 11:00 ` Heinrich Schuchardt
  1 sibling, 0 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2021-11-09 11:00 UTC (permalink / raw)
  To: Masahisa Kojima; +Cc: Ilias Apalodimas, Simon Glass, Alexander Graf, u-boot

On 11/9/21 10:44, Masahisa Kojima wrote:
> UEFI specification does not require that BootOrder is defined.
> In current implementation, boot variable measurement fails and
> returns EFI_NOT_FOUND if BootOrder is not defined.
> 
> This commit correcly handles this case, skip the boot variable
> measurement if BootOrder is not defined.
> 
> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>

=> tpm2 init && tpm2 startup TPM2_SU_CLEAR
=> efidebug boot order 1000
Found 0 disks
Missing RNG device for EFI_RNG_PROTOCOL
No EFI system partition
No EFI system partition
Failed to persist EFI variables
=> efidebug boot order
  1: Boot1000: (not defined)
=> bootefi hello
Booting /MemoryMapped(0x0,0x7ff9b1f0,0x11e0)
Boot1000 not found
Hello, world!
Running on UEFI 2.8
Have SMBIOS table
Have device tree
Load options: <none>
Boot device: /MemoryMapped(0x0,0x7ff9b1f0,0x11e0)
File path: <none>
=>

The message "Boot1000 not found" is created in
lib/efi_loader/efi_tcg2.c(1475) tcg2_measure_boot_variable().
That message should be log_debug(). But that can be done in a separate 
patch.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

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

end of thread, other threads:[~2021-11-09 11:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09  9:44 [PATCH] efi_loader: fix BootOrder variable measurement handling Masahisa Kojima
2021-11-09  9:44 ` Ilias Apalodimas
2021-11-09 11:00 ` Heinrich Schuchardt

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.