All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: yangge1116@126.com
Cc: ardb@kernel.org, sathyanarayanan.kuppuswamy@linux.intel.com,
	ilias.apalodimas@linaro.org, jgg@ziepe.ca,
	linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, liuzixing@hygon.cn
Subject: Re: [PATCH] efi/tpm: Fix the issue where the CC platforms event log header can't be correctly identified
Date: Fri, 4 Jul 2025 04:50:32 +0300	[thread overview]
Message-ID: <aGczaEkhPuOqhRUv@kernel.org> (raw)
In-Reply-To: <1751510317-12152-1-git-send-email-yangge1116@126.com>

On Thu, Jul 03, 2025 at 10:38:37AM +0800, yangge1116@126.com wrote:
> From: Ge Yang <yangge1116@126.com>
> 
> Since commit d228814b1913 ("efi/libstub: Add get_event_log() support
> for CC platforms") reuses TPM2 support code for the CC platforms, when
> launching a TDX virtual machine with coco measurement enabled, the
> following error log is generated:
> 
> [Firmware Bug]: Failed to parse event in TPM Final Events Log
> 
> Call Trace:
> efi_config_parse_tables()
>   efi_tpm_eventlog_init()
>     tpm2_calc_event_log_size()
>       __calc_tpm2_event_size()
> 
> The pcr_idx value in the Intel TDX log header is 1, causing the
> function __calc_tpm2_event_size() to fail to recognize the log header,
> ultimately leading to the "Failed to parse event in TPM Final Events
> Log" error.
> 
> According to UEFI Spec 2.10 Section 38.4.1: For Tdx, TPM PCR 0 maps to
> MRTD, so the log header uses TPM PCR 1. To successfully parse the TDX
> event log header, the check for a pcr_idx value of 0 has been removed
> here, and it appears that this will not affect other functionalities.

I'm not familiar with the original change but with a quick check it did
not change __calc_tpm2_event_size(). Your change is changing semantics
to two types of callers:

1. Those that caused the bug.
2. Those that nothing to do with this bug.

I'm not seeing anything explaining that your change is guaranteed not to
have any consequences to "innocent" callers, which have no relation to
the bug.

> 
> Link: https://uefi.org/specs/UEFI/2.10/38_Confidential_Computing.html#intel-trust-domain-extension
> Fixes: d228814b1913 ("efi/libstub: Add get_event_log() support for CC platforms")
> Signed-off-by: Ge Yang <yangge1116@126.com>
> Cc: stable@vger.kernel.org
> ---
>  include/linux/tpm_eventlog.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h
> index 891368e..05c0ae5 100644
> --- a/include/linux/tpm_eventlog.h
> +++ b/include/linux/tpm_eventlog.h
> @@ -202,8 +202,7 @@ static __always_inline u32 __calc_tpm2_event_size(struct tcg_pcr_event2_head *ev
>  	event_type = event->event_type;
>  
>  	/* Verify that it's the log header */
> -	if (event_header->pcr_idx != 0 ||
> -	    event_header->event_type != NO_ACTION ||
> +	if (event_header->event_type != NO_ACTION ||
>  	    memcmp(event_header->digest, zero_digest, sizeof(zero_digest))) {
>  		size = 0;
>  		goto out;
> -- 
> 2.7.4
> 

BR, Jarkko

  reply	other threads:[~2025-07-04  1:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-03  2:38 [PATCH] efi/tpm: Fix the issue where the CC platforms event log header can't be correctly identified yangge1116
2025-07-04  1:50 ` Jarkko Sakkinen [this message]
2025-07-04  2:53   ` Ge Yang
2025-07-04 15:13     ` Jarkko Sakkinen
2025-07-05  6:58       ` Ge Yang
2025-07-04 22:27     ` Sathyanarayanan Kuppuswamy
2025-07-05  6:59       ` Ge Yang

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=aGczaEkhPuOqhRUv@kernel.org \
    --to=jarkko@kernel.org \
    --cc=ardb@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuzixing@hygon.cn \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=stable@vger.kernel.org \
    --cc=yangge1116@126.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.