thread__find_map() chooses to exit without assigning a thread to the addr_location in some scenarios, for example when there are samples from a guest and perf_guest == false. This results in a segfault when adding to the histogram because it uses unguarded accesses to the thread member of the addr_location.
Fix it by exiting early if no thread is set. This fixes the referenced commit when using perf report with Coresight but probably isn't exclusive to that case.
Fixes: 8d3031d39fe8 ("perf cs-etm: Track exception level") Signed-off-by: James Clark james.clark@arm.com --- tools/perf/builtin-report.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index dcedfe00f04d..1a2caa4ce5c3 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -293,6 +293,9 @@ static int process_sample_event(struct perf_tool *tool, goto out_put; }
+ if (!al.thread) + goto out_put; + if (rep->stitch_lbr) thread__set_lbr_stitch_enable(al.thread, true);