]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
perf util: Fix bad memory access in trace info.
authorChris Phlipot <cphlipot0@gmail.com>
Wed, 29 Aug 2018 06:19:54 +0000 (23:19 -0700)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:52:15 +0000 (19:52 -0600)
BugLink: https://bugs.launchpad.net/bugs/1836426
[ Upstream commit a72f64261359b7451f8478f2a2bf357b4e6c757f ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
tools/perf/util/trace-event-info.c

index d7f2113462fbb97b3fb9e44294cd1be732831a45..be8afa37f0767d15a2bb0a4e38bec355eb28889f 100644 (file)
@@ -378,7 +378,7 @@ out:
 
 static int record_saved_cmdline(void)
 {
-       unsigned int size;
+       unsigned long long size;
        char *path;
        struct stat st;
        int ret, err = 0;