mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf util: Fix bad memory access in trace info.
@ 2018-08-29  6:19 cphlipot0
  2018-09-06 13:05 ` [tip:perf/core] " tip-bot for Chris Phlipot
  0 siblings, 1 reply; 2+ messages in thread
From: cphlipot0 @ 2018-08-29  6:19 UTC (permalink / raw)
  To: namhyung, acme; +Cc: peterz, mingo, linux-kernel, cphlipot0

From: Chris Phlipot <cphlipot0@gmail.com>

In the write to the output_fd in the error condition of
record_saved_cmdline(), we are writing 8 bytes from a memory location
on the stack that contains a primitive that is only 4 bytes in size.
Change the primitive to 8 bytes in size to match the size of the write
in order to avoid reading unknown memory from the stack.

Signed-off-by: Chris Phlipot <cphlipot0@gmail.com>
---
 tools/perf/util/trace-event-info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index c85d0d1a65ed..7b0ca7cbb7de 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -377,7 +377,7 @@ static int record_ftrace_printk(void)
 
 static int record_saved_cmdline(void)
 {
-	unsigned int size;
+	unsigned long long size;
 	char *path;
 	struct stat st;
 	int ret, err = 0;
-- 
2.17.1


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

* [tip:perf/core] perf util: Fix bad memory access in trace info.
  2018-08-29  6:19 [PATCH] perf util: Fix bad memory access in trace info cphlipot0
@ 2018-09-06 13:05 ` tip-bot for Chris Phlipot
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Chris Phlipot @ 2018-09-06 13:05 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, tglx, hpa, mingo, cphlipot0, linux-kernel, acme, namhyung

Commit-ID:  a72f64261359b7451f8478f2a2bf357b4e6c757f
Gitweb:     https://git.kernel.org/tip/a72f64261359b7451f8478f2a2bf357b4e6c757f
Author:     Chris Phlipot <cphlipot0@gmail.com>
AuthorDate: Tue, 28 Aug 2018 23:19:54 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 30 Aug 2018 14:50:50 -0300

perf util: Fix bad memory access in trace info.

In the write to the output_fd in the error condition of
record_saved_cmdline(), we are writing 8 bytes from a memory location on
the stack that contains a primitive that is only 4 bytes in size.
Change the primitive to 8 bytes in size to match the size of the write
in order to avoid reading unknown memory from the stack.

Signed-off-by: Chris Phlipot <cphlipot0@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180829061954.18871-1-cphlipot0@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/trace-event-info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index c85d0d1a65ed..7b0ca7cbb7de 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -377,7 +377,7 @@ out:
 
 static int record_saved_cmdline(void)
 {
-	unsigned int size;
+	unsigned long long size;
 	char *path;
 	struct stat st;
 	int ret, err = 0;

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

end of thread, other threads:[~2018-09-06 13:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-29  6:19 [PATCH] perf util: Fix bad memory access in trace info cphlipot0
2018-09-06 13:05 ` [tip:perf/core] " tip-bot for Chris Phlipot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome