Skip to content

Commit d0206db

Browse files
Ravi Bangoriaacmel
authored andcommitted
perf lock: Fix segfault due to missing kernel map
Kernel maps are encoded in PERF_RECORD_MMAP2 samples but "perf lock report" and "perf lock contention" do not process MMAP2 samples. Because of that, machine->vmlinux_map stays NULL and any later access triggers a segmentation fault. Fix it by adding ->mmap2() callbacks. Fixes: 53b00ff ("perf record: Make --buildid-mmap the default") Reported-by: Tycho Andersen (AMD) <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Signed-off-by: Ravi Bangoria <[email protected]> Tested-by: Tycho Andersen (AMD) <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ananth Narayan <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Sandipan Das <[email protected]> Cc: Santosh Shukla <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 84003ab commit d0206db

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/perf/builtin-lock.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,7 @@ static int __cmd_report(bool display_info)
18671867
eops.sample = process_sample_event;
18681868
eops.comm = perf_event__process_comm;
18691869
eops.mmap = perf_event__process_mmap;
1870+
eops.mmap2 = perf_event__process_mmap2;
18701871
eops.namespaces = perf_event__process_namespaces;
18711872
eops.tracing_data = perf_event__process_tracing_data;
18721873
session = perf_session__new(&data, &eops);
@@ -2023,6 +2024,7 @@ static int __cmd_contention(int argc, const char **argv)
20232024
eops.sample = process_sample_event;
20242025
eops.comm = perf_event__process_comm;
20252026
eops.mmap = perf_event__process_mmap;
2027+
eops.mmap2 = perf_event__process_mmap2;
20262028
eops.tracing_data = perf_event__process_tracing_data;
20272029

20282030
perf_env__init(&host_env);

0 commit comments

Comments
 (0)