All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix unallocated memory access in TPM eventlog code
@ 2016-03-01 23:03 Matthew Garrett
       [not found] ` <1456873414-6127-1-git-send-email-mjg59-JW9irJGTvgXQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Garrett @ 2016-03-01 23:03 UTC (permalink / raw)
  To: peterhuewe-Mmb7MZpHnFY
  Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Matthew Garrett,
	stable-DgEjT+Ai2ygdnm+yROfE0A

COmmit 0cc698 added support for handling endian fixups in the event log code
but broke the binary log file in the process. Keep the endian code, but read
the event data from the actual event rather than from unallocated RAM.

Signed-off-by: Matthew Garrett <mjg59-JW9irJGTvgXQT0dZR+AlfA@public.gmane.org>
Cc: stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
---
Should be applied to 4.4
 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..e47092c 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); i++)
+		seq_putc(m, tempPtr[i]);
+
+	tempPtr = (char *)&event->event_data;
+
+	for (i = 0; i < temp_event.event_size; i++)
 		seq_putc(m, tempPtr[i]);
 
 	return 0;
-- 
2.5.0


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix unallocated memory access in TPM eventlog code
       [not found] ` <1456873414-6127-1-git-send-email-mjg59-JW9irJGTvgXQT0dZR+AlfA@public.gmane.org>
@ 2016-03-02  0:03   ` Jason Gunthorpe
       [not found]     ` <20160302000302.GA447-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Gunthorpe @ 2016-03-02  0:03 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	stable-DgEjT+Ai2ygdnm+yROfE0A

On Tue, Mar 01, 2016 at 03:03:34PM -0800, Matthew Garrett wrote:
> COmmit 0cc698 added support for handling endian fixups in the event log code
> but broke the binary log file in the process. Keep the endian code, but read
> the event data from the actual event rather than from unallocated RAM.

This patch is doing the same thing?

https://git.kernel.org/cgit/linux/kernel/git/jmorris/linux-security.git/commit/drivers/char/tpm/tpm_eventlog.c?h=next&id=186d124f07da193a8f47e491af85cb695d415f2f

Already on it's way to mainline.

> -	for (i = 0; i < sizeof(struct tcpa_event) + temp_event.event_size; i++)
> +	for (i = 0; i < sizeof(struct tcpa_event); i++)
> +		seq_putc(m, tempPtr[i]);
> +
> +	tempPtr = (char *)&event->event_data;
> +
> +	for (i = 0; i < temp_event.event_size; i++)
>  		seq_putc(m, tempPtr[i]);

Though this does look more elegant.

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] 3+ messages in thread

* Re: [PATCH] Fix unallocated memory access in TPM eventlog code
       [not found]     ` <20160302000302.GA447-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2016-03-02  0:22       ` Matthew Garrett
  0 siblings, 0 replies; 3+ messages in thread
From: Matthew Garrett @ 2016-03-02  0:22 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	stable-DgEjT+Ai2ygdnm+yROfE0A

On Tue, Mar 1, 2016 at 4:03 PM, Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote:
> https://git.kernel.org/cgit/linux/kernel/git/jmorris/linux-security.git/commit/drivers/char/tpm/tpm_eventlog.c?h=next&id=186d124f07da193a8f47e491af85cb695d415f2f
>
> Already on it's way to mainline.

Works for me.

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-02  0:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-01 23:03 [PATCH] Fix unallocated memory access in TPM eventlog code Matthew Garrett
     [not found] ` <1456873414-6127-1-git-send-email-mjg59-JW9irJGTvgXQT0dZR+AlfA@public.gmane.org>
2016-03-02  0:03   ` Jason Gunthorpe
     [not found]     ` <20160302000302.GA447-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-03-02  0:22       ` Matthew Garrett

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.