linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] efi/tpm: Differentiate missing and invalid final event log table.
@ 2021-07-08  9:46 Michal Suchanek
  2021-07-09 16:38 ` Jarkko Sakkinen
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Suchanek @ 2021-07-08  9:46 UTC (permalink / raw)
  To: linux-integrity, Ard Biesheuvel
  Cc: Michal Suchanek, Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe,
	Loïc Yhuel, Javier Martinez Canillas, Jerry Snitselaar,
	Matthew Garrett, linux-efi, linux-kernel

Missing TPM final event log table is not a firmware bug.

Clearly if providing event log in the old format makes the final event
log invalid it should not be provided at least in that case.

Fixes: b4f1874c6216 ("tpm: check event log version before reading final events")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 drivers/firmware/efi/tpm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
index c1955d320fec..8f665678e9e3 100644
--- a/drivers/firmware/efi/tpm.c
+++ b/drivers/firmware/efi/tpm.c
@@ -62,9 +62,11 @@ int __init efi_tpm_eventlog_init(void)
 	tbl_size = sizeof(*log_tbl) + log_tbl->size;
 	memblock_reserve(efi.tpm_log, tbl_size);
 
-	if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR ||
-	    log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
-		pr_warn(FW_BUG "TPM Final Events table missing or invalid\n");
+	if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR) {
+		pr_info("TPM Final Events table not present\n");
+		goto out;
+	} else if (log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
+		pr_warn(FW_BUG "TPM Final Events table invalid\n");
 		goto out;
 	}
 
-- 
2.26.2


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

* Re: [PATCH] efi/tpm: Differentiate missing and invalid final event log table.
  2021-07-08  9:46 [PATCH] efi/tpm: Differentiate missing and invalid final event log table Michal Suchanek
@ 2021-07-09 16:38 ` Jarkko Sakkinen
  2021-07-16 16:04   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Sakkinen @ 2021-07-09 16:38 UTC (permalink / raw)
  To: Michal Suchanek
  Cc: linux-integrity, Ard Biesheuvel, Peter Huewe, Jason Gunthorpe,
	Loïc Yhuel, Javier Martinez Canillas, Jerry Snitselaar,
	Matthew Garrett, linux-efi, linux-kernel

On Thu, Jul 08, 2021 at 11:46:54AM +0200, Michal Suchanek wrote:
> Missing TPM final event log table is not a firmware bug.
> 
> Clearly if providing event log in the old format makes the final event
> log invalid it should not be provided at least in that case.
> 
> Fixes: b4f1874c6216 ("tpm: check event log version before reading final events")
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
>  drivers/firmware/efi/tpm.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
> index c1955d320fec..8f665678e9e3 100644
> --- a/drivers/firmware/efi/tpm.c
> +++ b/drivers/firmware/efi/tpm.c
> @@ -62,9 +62,11 @@ int __init efi_tpm_eventlog_init(void)
>  	tbl_size = sizeof(*log_tbl) + log_tbl->size;
>  	memblock_reserve(efi.tpm_log, tbl_size);
>  
> -	if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR ||
> -	    log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
> -		pr_warn(FW_BUG "TPM Final Events table missing or invalid\n");
> +	if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR) {
> +		pr_info("TPM Final Events table not present\n");
> +		goto out;
> +	} else if (log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
> +		pr_warn(FW_BUG "TPM Final Events table invalid\n");
>  		goto out;
>  	}
>  
> -- 
> 2.26.2
> 
> 

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

/Jarkko

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

* Re: [PATCH] efi/tpm: Differentiate missing and invalid final event log table.
  2021-07-09 16:38 ` Jarkko Sakkinen
@ 2021-07-16 16:04   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2021-07-16 16:04 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Michal Suchanek, linux-integrity, Peter Huewe, Jason Gunthorpe,
	Loïc Yhuel, Javier Martinez Canillas, Jerry Snitselaar,
	Matthew Garrett, linux-efi, Linux Kernel Mailing List

On Fri, 9 Jul 2021 at 18:38, Jarkko Sakkinen <jarkko@kernel.org> wrote:
>
> On Thu, Jul 08, 2021 at 11:46:54AM +0200, Michal Suchanek wrote:
> > Missing TPM final event log table is not a firmware bug.
> >
> > Clearly if providing event log in the old format makes the final event
> > log invalid it should not be provided at least in that case.
> >
> > Fixes: b4f1874c6216 ("tpm: check event log version before reading final events")
> > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > ---
> >  drivers/firmware/efi/tpm.c | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
> > index c1955d320fec..8f665678e9e3 100644
> > --- a/drivers/firmware/efi/tpm.c
> > +++ b/drivers/firmware/efi/tpm.c
> > @@ -62,9 +62,11 @@ int __init efi_tpm_eventlog_init(void)
> >       tbl_size = sizeof(*log_tbl) + log_tbl->size;
> >       memblock_reserve(efi.tpm_log, tbl_size);
> >
> > -     if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR ||
> > -         log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
> > -             pr_warn(FW_BUG "TPM Final Events table missing or invalid\n");
> > +     if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR) {
> > +             pr_info("TPM Final Events table not present\n");
> > +             goto out;
> > +     } else if (log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
> > +             pr_warn(FW_BUG "TPM Final Events table invalid\n");
> >               goto out;
> >       }
> >
> > --
> > 2.26.2
> >
> >
>
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
>

Queued as a fix, thanks

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

end of thread, other threads:[~2021-07-16 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08  9:46 [PATCH] efi/tpm: Differentiate missing and invalid final event log table Michal Suchanek
2021-07-09 16:38 ` Jarkko Sakkinen
2021-07-16 16:04   ` Ard Biesheuvel

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).