mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ge Yang <yangge1116@126.com>
To: James Bottomley <James.Bottomley@HansenPartnership.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 V3] efi/tpm: Fix the issue where the CC platforms event log header can't be correctly identified
Date: Fri, 11 Jul 2025 09:23:56 +0800	[thread overview]
Message-ID: <ec847802-5189-461a-a372-f81839938579@126.com> (raw)
In-Reply-To: <0925430dad9e55179be0df89d8af1df72dfa0c89.camel@HansenPartnership.com>



在 2025/7/11 5:58, James Bottomley 写道:
> On Mon, 2025-07-07 at 11:14 +0800, yangge1116@126.com wrote:
>> 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.
> 
> I think someone has misread the spec.  EV_NO_ACTION events produce no
> PCR extension.  So the PCR value zero is conventional (and required by
> the TCG) since nothing gets logged.  Therefore even if you're
> technically using PCR0 for something else EV_NO_ACTION events should
> still have the conventional PCR = 0 value to conform to the TCG spec.
> I assume it's too late to correct this in the implementation?
> 

According to Table 14 in Section 10.4.1 of the TCG PC Client 
Specification, for EV_NO_ACTION events, the PCR (Platform Configuration 
Register) value can be 0 or other values, such as 6.

Link: 
https://trustedcomputinggroup.org/wp-content/uploads/TCG_PCClient_PFP_r1p05_v23_pub.pdf

>>   __calc_tpm2_event_size(struct tcg_pcr_event2_head *ev
>>   	count = event->count;
>>   	event_type = event->event_type;
>>   
>> -	/* Verify that it's the log header */
>> -	if (event_header->pcr_idx != 0 ||
>> +	/*
>> +	 * Verify that it's the log header. According to the TCG PC
>> Client
>> +	 * Specification, when identifying a log header, the check
>> for a
>> +	 * pcr_idx value of 0 is not required. For CC platforms,
>> skipping
>> +	 * this check during log header is necessary; otherwise, the
>> CC
>> +	 * platform's log header may fail to be recognized.
>> +	 */
>> +	if ((!is_cc_event && event_header->pcr_idx != 0) ||
>>   	    event_header->event_type != NO_ACTION ||
>>   	    memcmp(event_header->digest, zero_digest,
>> sizeof(zero_digest))) {
>>   		size = 0;
> 
> The above is just a heuristic to recognize an EV_NO_ACTION event as
> zero size.  All the TCG specs require that EV_NO_ACTION have pcr 0 in
> the event, but if the heuristic is wrong because of Intel/CC spec
> violations which can't be fixed, then we should update the heuristic
> ... so I don't think you need to thread the is_cc_event.

It seems that the TCG specifications do not stipulate that the 
EV_NO_ACTION event must have PCR 0. In addition, adding is_cc_event can 
maximize the reuse of TPM code for CC platforms without disrupting TPM 
functionality; otherwise, new functions would need to be added for CC 
platforms.

Please review the latest patch. Patch link: 
https://lore.kernel.org/lkml/1751961289-29673-1-git-send-email-yangge1116@126.com/

> 
> Regards,
> 
> James


  reply	other threads:[~2025-07-11  1:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-07  3:14 yangge1116
2025-07-08  1:19 ` Ard Biesheuvel
2025-07-08  7:39   ` Ge Yang
2025-07-10 21:58 ` James Bottomley
2025-07-11  1:23   ` Ge Yang [this message]
2025-07-11 12:32     ` James Bottomley

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=ec847802-5189-461a-a372-f81839938579@126.com \
    --to=yangge1116@126.com \
    --cc=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 \
    /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

all inboxes | Powered by JetHome®