perf tools: Fix segfault due to invalid kernel dso access
Namhyung Kim
maintainerPATCH 1/1 perf tools: Fix segfault due to invalid kernel dso access
Jiri reported that the commit 96d78059d6d9 ("perf tools: Make vmlinux short name more like kallsyms short name") segfaults on perf script.
When processing kernel mmap event, it should access the 'kernel' variable as sometimes it cannot find a matching dso from build-id table so 'dso' might be invalid.
--- tools/perf/util/machine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/machine.c +2 -2
@@ -1106,8 +1106,8 @@ static int machine__process_kernel_mmap_event(struct machine *machine,if (__machine__create_kernel_maps (machine, kernel) <0 ) goto out_problem; -if (strstr (dso->long_name,"vmlinux" )) -dso__set_short_name (dso,"[kernel.vmlinux]" , false); +if (strstr (kernel->long_name,"vmlinux" )) +dso__set_short_name (kernel,"[kernel.vmlinux]" , false);machine__set_kernel_mmap_len (machine, event);
Signature · 1 line
2.1.2
Namhyung Kim
maintainerArnaldo,
Could you please consider applying this?
Thanks,
Namhyung
Quoted 28 lines · Namhyung Kim
Jiri reported that the commit
96d78059d6d9("perf tools: Make vmlinux short name more like kallsyms short name") segfaults on perf script.When processing kernel mmap event, it should access the 'kernel' variable as sometimes it cannot find a matching dso from build-id table so 'dso' might be invalid.
Reported-by Jiri Olsa <[email protected]>Tested-by Jiri Olsa <[email protected]>Signed-off-by Namhyung Kim <[email protected]>--- tools/perf/util/machine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/perf/util/machine.c +2
-2@@ -1106,8 +1106,8 @@ static int machine__process_kernel_mmap_event(struct machine *machine,if (__machine__create_kernel_maps (machine, kernel) <0 ) goto out_problem; -if (strstr (dso->long_name,"vmlinux" )) -dso__set_short_name (dso,"[kernel.vmlinux]" , false); +if (strstr (kernel->long_name,"vmlinux" )) +dso__set_short_name (kernel,"[kernel.vmlinux]" , false);machine__set_kernel_mmap_len (machine, event);
Arnaldo Carvalho de Melo
maintainerEm Thu, Nov 20, 2014 at 03:44:36PM +0900, Namhyung Kim escreveu:
Quoted 3 lines
Arnaldo,
Could you please consider applying this?
Right, I should've added this to the previous pull req, will be on the next.
- Arnaldo
Quoted 33 lines
Thanks,
NamhyungQuoted 28 lines · Namhyung Kim
Jiri reported that the commit
96d78059d6d9("perf tools: Make vmlinux short name more like kallsyms short name") segfaults on perf script.When processing kernel mmap event, it should access the 'kernel' variable as sometimes it cannot find a matching dso from build-id table so 'dso' might be invalid.
Reported-by Jiri Olsa <[email protected]>Tested-by Jiri Olsa <[email protected]>Signed-off-by Namhyung Kim <[email protected]>--- tools/perf/util/machine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/perf/util/machine.c +2
-2@@ -1106,8 +1106,8 @@ static int machine__process_kernel_mmap_event(struct machine *machine,if (__machine__create_kernel_maps (machine, kernel) <0 ) goto out_problem; -if (strstr (dso->long_name,"vmlinux" )) -dso__set_short_name (dso,"[kernel.vmlinux]" , false); +if (strstr (kernel->long_name,"vmlinux" )) +dso__set_short_name (kernel,"[kernel.vmlinux]" , false);machine__set_kernel_mmap_len (machine, event);
tip-bot for Namhyung Kim
merge botperf tools: Fix segfault due to invalid kernel dso access
Commit-ID: 330dfa224fcc8594977785a6493ca06d124f0cfe Gitweb: http://git.kernel.org/tip/330dfa224fcc8594977785a6493ca06d124f0cfe Author: Namhyung Kim <[email protected]> AuthorDate: Tue, 18 Nov 2014 13:30:28 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 24 Nov 2014 18:03:48 -0300
perf tools: Fix segfault due to invalid kernel dso access
Jiri reported that the commit 96d78059d6d9 ("perf tools: Make vmlinux short name more like kallsyms short name") segfaults on perf script.
When processing kernel mmap event, it should access the 'kernel' variable as sometimes it cannot find a matching dso from build-id table so 'dso' might be invalid.
--- tools/perf/util/machine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/machine.c +2 -2
@@ -1106,8 +1106,8 @@ static int machine__process_kernel_mmap_event(struct machine *machine,if (__machine__create_kernel_maps (machine, kernel) <0 ) goto out_problem; -if (strstr (dso->long_name,"vmlinux" )) -dso__set_short_name (dso,"[kernel.vmlinux]" , false); +if (strstr (kernel->long_name,"vmlinux" )) +dso__set_short_name (kernel,"[kernel.vmlinux]" , false);machine__set_kernel_mmap_len (machine, event);