Skip to contentSkip to conversation

tpm2_eventlog ERROR: SpecID eventType must be EV_NO_ACTION

tpm2 nicolasoliver03 at gmail.com 2 participants 6 messages Apr 7, 2021 – Apr 15, 2021

lore
Share & tools
lore

nicolasoliver03 at gmail.com

#0 lore raw

Hello!

I was recently trying to inspect TPM Event Logs with the tpm2_eventlog command. I am getting the following error:

---
ERROR on line: "235" in file: "lib/tpm2_eventlog.c": SpecID eventType must be EV_NO_ACTION ERROR on line: "79" in file: "tools/misc/tpm2_eventlog.c": failed to parse tpm2 eventlog ERROR on line: "146" in file: "tools/tpm2_tool.c": Unable to run tpm2_eventlog

I tried with tsseventextend as well, and I got a similar error message:

eventextend: failed, rc 0000009a
TPM_RC_INSUFFICIENT - the TPM was unable to unmarshal a value because there were not enough octets in the input buffer Handle number unspecified

And then tried with fwupdtpmevlog command, and I got it parsed, but the reconstructed PCR 4 does not match the state of the actual TPM PCR 4 state.

Is it accurate to say that the TPM Event Log I am parsing is corrupted?
And potentially, the corrupted entry is related to the PCR 4 measurements, and that's why I get a mismatch in the reconstruction?

Thanks!

#1 lore raw
Quoted 5 lines

From: nicolasoliver03(a)gmail.com
To: tpm2(a)lists.01.org
Date: 04/07/2021 02:12 PM
Subject: [EXTERNAL] [tpm2] tpm2_eventlog ERROR: SpecID eventType must be EV_NO_ACTION

Does the subject agree with this issue?

Quoted 7 lines

Hello!

I was recently trying to inspect TPM Event Logs with the tpm2_eventlog command.
I am getting the following error:

Quoted 6 lines

---
ERROR on line: "235" in file: "lib/tpm2_eventlog.c": SpecID eventType must be EV_NO_ACTION
ERROR on line: "79" in file: "tools/misc/tpm2_eventlog.c": failed to parse tpm2 eventlog
ERROR on line: "146" in file: "tools/tpm2_tool.c": Unable to run

tpm2_eventlog

Quoted 7 lines

I tried with tsseventextend as well, and I got a similar error message:

eventextend: failed, rc 0000009a
TPM_RC_INSUFFICIENT - the TPM was unable to unmarshal a value because there were not enough octets in the input buffer Handle number unspecified

Two suggestions to help us:

1 - Can you upload the event log so we can debug it?

2 - Can you run tsseventextend -v (verbose tracing)?

Quoted 6 lines

And then tried with fwupdtpmevlog command, and I got it parsed, but the reconstructed PCR 4 does not match the state of the actual TPM PCR 4 state.

Is it accurate to say that the TPM Event Log I am parsing is corrupted?

Not yet. Let's debug before we decide where the bug is.

Quoted 9 lines

And potentially, the corrupted entry is related to the PCR 4 measurements, and that's why I get a mismatch in the reconstruction?

Thanks!
_______________________________________________
tpm2 mailing list -- tpm2(a)lists.01.org
To unsubscribe send an email to tpm2-leave(a)lists.01.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

#2 lore raw

The output of tsseventextend -v is below.
I am getting this same error in 2 servers from different manufacturers. I may need to cleanup a little before sharing the logs, please bear with me!

eventextend: line 0
TSS_EVENT_Line_Trace: PCR index 0
TSS_EVENT_EventType_Trace: 00000008 EV_S_CRTM_VERSION
TSS_EVENT_Line_Trace: PCR length 20
c4 2f ed ad 26 82 00 cb 1d 15 f9 78 41 c3 44 e7
9d ae 33 20
TSS_EVENT_Line_Trace: event length 16
1e fb 6b 54 0c 1d 55 40 a4 ad 4e f4 bf 17 b8 3a
eventextend: failed, rc 0000009a
TPM_RC_INSUFFICIENT - the TPM was unable to unmarshal a value because there were not enough octets in the input buffer Handle number unspecified

#3 lore raw

The error is basic - it's not a legal TPM 2.0 event log.

The first event (line 0) has to be a EV_NO_ACTION event with a TCG_EfiSpecIDEvent structure. I have a -nospec option, but that's just to test incremental logs. It's not intended for a full log.

From the TCG spec:

3. The first event log entry SHALL be a TCG_PCClientPCREvent structure.
See Section 10.2.1 TCG_PCClientPCREvent Structure.

--
Ken Goldman kgoldman(a)us.ibm.com
914-945-2415 (862-2415)

From: nicolasoliver03(a)gmail.com
To: tpm2(a)lists.01.org
Date: 04/09/2021 12:47 PM
Subject: [EXTERNAL] [tpm2] Re: tpm2_eventlog ERROR: SpecID eventType
must be EV_NO_ACTION

The output of tsseventextend -v is below.
I am getting this same error in 2 servers from different manufacturers. I may need to cleanup a little before sharing the logs, please bear with me!

eventextend: line 0
TSS_EVENT_Line_Trace: PCR index 0
TSS_EVENT_EventType_Trace: 00000008 EV_S_CRTM_VERSION
TSS_EVENT_Line_Trace: PCR length 20
c4 2f ed ad 26 82 00 cb 1d 15 f9 78 41 c3 44 e7
9d ae 33 20
TSS_EVENT_Line_Trace: event length 16
1e fb 6b 54 0c 1d 55 40 a4 ad 4e f4 bf 17 b8 3a
eventextend: failed, rc 0000009a
TPM_RC_INSUFFICIENT - the TPM was unable to unmarshal a value because there were not enough octets in the input buffer Handle number unspecified
_______________________________________________
tpm2 mailing list -- tpm2(a)lists.01.org
To unsubscribe send an email to tpm2-leave(a)lists.01.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

#4 lore raw

Hello again,

I have been debugging this issue with the manufacturer for a couple of days, and found something very interesting. Initially, I thought it was a System Firmware (BIOS) problem, that it was misbehaving and reporting an invalid log. But it seems to be a Kernel related problem.

If the system is booted with a customized Linux Kernel 4.19, the TPM Event Log present in sysfs is invalid: tools fails to parse it, and there are no SHA256 measurements.
If the system is booted with a vanilla Linux Kernel 5.8.15 (Fedora Workstation 33 Live), the TPM Event Log is valid, tools can parse it, there are both SHA1 and SHA256 measurements, and the reconstruction matches perfectly with the state of the TPM PCRs

This is more evident by comparing the binary_bios_measurements files taken from both executions. I can see the good one starting with "Spec ID Ev..", and the bad one directly with "Secure Boot" related info

The git history of the kernel source related to TPM Event Log is available here https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/char/tpm/eventlog.
I will look there to see if something shed some light to this issue.

Any hints are appreciated,

Thank you for your help so far!

#5 lore raw

In theory, the BIOS event log is constructed pre-OS, and certainly the beginning part should not be affected.

If you're booting two different kernels and the first event changes, my first guess is that something in the kernel is affecting the pseudo-file and skipping or deleting the first measurement. "Customized Linux kernel" sounds suspicious.

I think you might have a better audience on the Linux security mailing list.

--
Ken Goldman kgoldman(a)us.ibm.com
914-945-2415 (862-2415)

From: nicolasoliver03(a)gmail.com
To: tpm2(a)lists.01.org
Date: 04/15/2021 02:26 PM
Subject: [EXTERNAL] [tpm2] Re: tpm2_eventlog ERROR: SpecID eventType
must be EV_NO_ACTION

Hello again,

I have been debugging this issue with the manufacturer for a couple of days, and found something very interesting.
Initially, I thought it was a System Firmware (BIOS) problem, that it was misbehaving and reporting an invalid log.
But it seems to be a Kernel related problem.

If the system is booted with a customized Linux Kernel 4.19, the TPM Event Log present in sysfs is invalid: tools fails to parse it, and there are no SHA256 measurements.
If the system is booted with a vanilla Linux Kernel 5.8.15 (Fedora Workstation 33 Live), the TPM Event Log is valid, tools can parse it, there are both SHA1 and SHA256 measurements, and the reconstruction matches perfectly with the state of the TPM PCRs

This is more evident by comparing the binary_bios_measurements files taken from both executions. I can see the good one starting with "Spec ID Ev..", and the bad one directly with "Secure Boot" related info

The git history of the kernel source related to TPM Event Log is available here
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/char/tpm/eventlog
.
I will look there to see if something shed some light to this issue.

Any hints are appreciated,

Thank you for your help so far!
_______________________________________________
tpm2 mailing list -- tpm2(a)lists.01.org
To unsubscribe send an email to tpm2-leave(a)lists.01.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s