lkml.org 
[lkml]   [2023]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] perf report: Don't add to histogram when there is no thread found
Date
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);

--
2.34.1
\
 
 \ /
  Last update: 2023-06-26 18:11    [W:0.092 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site