Skip to content

Commit 330dfa2

Browse files
namhyungacmel
authored andcommitted
perf tools: Fix segfault due to invalid kernel dso access
Jiri reported that the commit 96d7805 ("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]> Cc: Adrian Hunter <[email protected]> Cc: David Ahern <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 85c116a commit 330dfa2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/perf/util/machine.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1106,8 +1106,8 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
11061106
if (__machine__create_kernel_maps(machine, kernel) < 0)
11071107
goto out_problem;
11081108

1109-
if (strstr(dso->long_name, "vmlinux"))
1110-
dso__set_short_name(dso, "[kernel.vmlinux]", false);
1109+
if (strstr(kernel->long_name, "vmlinux"))
1110+
dso__set_short_name(kernel, "[kernel.vmlinux]", false);
11111111

11121112
machine__set_kernel_mmap_len(machine, event);
11131113

0 commit comments

Comments
 (0)