stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: yangge1116@126.com, ardb@kernel.org
Cc: jarkko@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 V4] efi/tpm: Fix the issue where the CC platforms event log header can't be correctly identified
Date: Fri, 11 Jul 2025 07:00:47 -0700	[thread overview]
Message-ID: <757cd21fb4eaebf0f89af1a5290c6f6665f66bae.camel@HansenPartnership.com> (raw)
In-Reply-To: <1751961289-29673-1-git-send-email-yangge1116@126.com>

On Tue, 2025-07-08 at 15:54 +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 Specification 2.10, Section 38.4.1: For TDX, TPM
> PCR 0 maps to MRTD, so the log header uses TPM PCR 1 instead. To
> successfully parse the TDX event log header, the check for a pcr_idx
> value of 0 must be skipped.
> 
> According to Table 6 in Section 10.2.1 of the TCG PC Client
> Specification, the index field does not require the PCR index to be
> fixed at zero. Therefore, skipping the check for a pcr_idx value of
> 0 for CC platforms is safe.

This is wrong: the spec does not allow a header EV_ACTION to be
recorded with anything other than pcrIndex == 0.

However, the fact that Intel, who practically wrote the TPM spec, can
get this wrong shows that others can too.  So the best way to fix this
is to remove the pcrIndex check for the first event.  There's no danger
of this causing problems because we check for the TCG_SPECID_SIG
signature as the next thing.  That means you don't need to thread
knowledge of whether this is a CC environment and we're pre-emptively
ready for any other spec violators who misread the spec in the same way
Intel did.

Regards,

James


  reply	other threads:[~2025-07-11 14:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-08  7:54 [PATCH V4] efi/tpm: Fix the issue where the CC platforms event log header can't be correctly identified yangge1116
2025-07-11 14:00 ` James Bottomley [this message]
2025-07-11 17:01   ` Sathyanarayanan Kuppuswamy
2025-07-12  2:24     ` 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=757cd21fb4eaebf0f89af1a5290c6f6665f66bae.camel@HansenPartnership.com \
    --to=james.bottomley@hansenpartnership.com \
    --cc=ardb@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jarkko@kernel.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 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).