* Re: [PATCH] tpm_eventlog.c: fix binary_bios_measurements
[not found] ` <56B9C234.5050402-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2016-02-09 17:33 ` Jason Gunthorpe
2016-02-10 3:54 ` Jarkko Sakkinen
1 sibling, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2016-02-09 17:33 UTC (permalink / raw)
To: Harald Hoyer; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Tue, Feb 09, 2016 at 11:40:52AM +0100, Harald Hoyer wrote:
> From 57558a66cfadd329cdf63570af7ad1d0fd61010f Mon Sep 17 00:00:00 2001
> From: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> 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/
> 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.
>
> Signed-off-by: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> drivers/char/tpm/tpm_eventlog.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/tpm/tpm_eventlog.c b/drivers/char/tpm/tpm_eventlog.c
> 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)
>
> 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.
Reviewed-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] tpm_eventlog.c: fix binary_bios_measurements
[not found] ` <56B9C234.5050402-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-02-09 17:33 ` [PATCH] tpm_eventlog.c: fix binary_bios_measurements Jason Gunthorpe
@ 2016-02-10 3:54 ` Jarkko Sakkinen
1 sibling, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2016-02-10 3:54 UTC (permalink / raw)
To: Harald Hoyer; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Tue, Feb 09, 2016 at 11:40:52AM +0100, Harald Hoyer wrote:
> 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 <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Date: Sat, 6 Feb 2016 15:44:42 +0100
> Subject: [PATCH] tpm_eventlog.c: fix binary_bios_measurements
>
> 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.
>
> Signed-off-by: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
PS. Don't send a new patch. I can put the "Fixes:" tag in place.
/Jarkko
> ---
> drivers/char/tpm/tpm_eventlog.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/tpm/tpm_eventlog.c b/drivers/char/tpm/tpm_eventlog.c
> index bd72fb0..a21624f 100644
> --- a/drivers/char/tpm/tpm_eventlog.c
> +++ b/drivers/char/tpm/tpm_eventlog.c
> @@ -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;
> --
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread