From nobody Mon Feb 9 00:54:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D59B2EB64DC for ; Mon, 26 Jun 2023 16:11:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231770AbjFZQLV (ORCPT ); Mon, 26 Jun 2023 12:11:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231737AbjFZQLQ (ORCPT ); Mon, 26 Jun 2023 12:11:16 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A87A5E53; Mon, 26 Jun 2023 09:11:14 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 68E00143D; Mon, 26 Jun 2023 09:11:58 -0700 (PDT) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D39D63F663; Mon, 26 Jun 2023 09:11:11 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org Cc: James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Suzuki K Poulose , Mike Leach , Leo Yan , John Garry , Will Deacon , linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] perf report: Don't add to histogram when there is no thread found Date: Mon, 26 Jun 2023 17:10:58 +0100 Message-Id: <20230626161059.324046-3-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230626161059.324046-1-james.clark@arm.com> References: <20230626161059.324046-1-james.clark@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 =3D=3D 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 Acked-by: Ian Rogers --- 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; } =20 + if (!al.thread) + goto out_put; + if (rep->stitch_lbr) thread__set_lbr_stitch_enable(al.thread, true); =20 --=20 2.34.1