Skip to content

Commit

Permalink
perf util: Fix bad memory access in trace info.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chris Phlipot authored and Arnaldo Carvalho de Melo committed Aug 30, 2018
1 parent dad2762 commit a72f642
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/perf/util/trace-event-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a72f642

Please sign in to comment.