[PATCH 2/2] perf report: Don't add to histogram when there is no thread found
James Clark
james.clark at arm.com
Mon Jun 26 09:10:58 PDT 2023
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 at 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);
--
2.34.1
More information about the linux-arm-kernel
mailing list