Skip to contentSkip to conversation

tpm_eventlog.c: fix binary_bios_measurements

PATCH Jason Gunthorpe 2 participants 2 messages Feb 9, 2016 – Feb 10, 2016 2 messages not in the archive

lore
Share & tools
lore

Jason Gunthorpe

author Reviewed-by
#2 lore raw
In reply to a message not in the archive
Quoted 7 lines · Harald Hoyer

From 57558a66cfadd329cdf63570af7ad1d0fd61010f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <[email protected]>
Date: Sat, 6 Feb 2016 15:44:42 +0100
Subject: [PATCH] tpm_eventlog.c: fix binary_bios_measurements

commit 0cc698af36ff22295dce2f5e46b0cfe605789fa4 copied the event, but

This should be a fixes line, see Documentation/

Quoted 13 lines

without the event data, did an endian conversion on the size and tried to output the event data from the copied version, which has only have one byte of the data, resulting in garbage event data.

 drivers/char/tpm/tpm_eventlog.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_eventlog.c +1 -0
index bd72fb0..a21624f 100644
+++ b/drivers/char/tpm/tpm_eventlog.c
@@ -244,7 +244,12 @@ static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v)
 

drivers/char/tpm/tpm_eventlog.c static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v) · line 253

Quoted 10 lines
drivers/char/tpm/tpm_eventlog.c +6 -1
 	tempPtr = (char *)&temp_event;
 
-	for (i = 0; i < sizeof(struct tcpa_event) + temp_event.event_size; i++)
+	for (i = 0; i < sizeof(struct tcpa_event)-1 ; i++)
+		seq_putc(m, tempPtr[i]);
+
+	tempPtr = (char *)v;
+
+	for (i = sizeof(struct tcpa_event)-1; i < sizeof(struct tcpa_event) + temp_event.event_size; i++)
 		seq_putc(m, tempPtr[i]);

Looks reasonable otherwise.

Jason

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140

Reviewed-by
#3 lore raw
In reply to a message not in the archive
Quoted 13 lines · Harald Hoyer

Find attached a patch for the tpm kernel driver, which is fixing /sys/kernel/security/tpm0/binary_bios_measurements

Thanks!

Harald Hoyer

From 57558a66cfadd329cdf63570af7ad1d0fd61010f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <[email protected]>
Date: Sat, 6 Feb 2016 15:44:42 +0100
Subject: [PATCH] tpm_eventlog.c: fix binary_bios_measurements

Quoted 6 lines

commit 0cc698af36ff22295dce2f5e46b0cfe605789fa4 copied the event, but without the event data, did an endian conversion on the size and tried to output the event data from the copied version, which has only have one byte of the data, resulting in garbage event data.

PS. Don't send a new patch. I can put the "Fixes:" tag in place.

/Jarkko

Quoted 25 lines
---
 drivers/char/tpm/tpm_eventlog.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_eventlog.c +6 -1
index bd72fb0..a21624f 100644
@@ -244,7 +244,12 @@ static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v)
 
 	tempPtr = (char *)&temp_event;
 
-	for (i = 0; i < sizeof(struct tcpa_event) + temp_event.event_size; i++)
+	for (i = 0; i < sizeof(struct tcpa_event)-1 ; i++)
+		seq_putc(m, tempPtr[i]);
+
+	tempPtr = (char *)v;
+
+	for (i = sizeof(struct tcpa_event)-1; i < sizeof(struct tcpa_event) + temp_event.event_size; i++)
 		seq_putc(m, tempPtr[i]);
 
 	return 0;
Signature · 1 line
2.7.0

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140