Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1341668ybb; Sat, 4 Apr 2020 01:44:40 -0700 (PDT) X-Google-Smtp-Source: APiQypItTyfkSihnSnkC/CMw88LFXDNswequceiZ1hQNmMgxwPGi8Z4CskaOtI4QxaSeieMwAc7c X-Received: by 2002:aca:c488:: with SMTP id u130mr6168221oif.154.1585989880566; Sat, 04 Apr 2020 01:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585989880; cv=none; d=google.com; s=arc-20160816; b=LG8+2WPOm55Otyo7QNAenNJaoIU0Z2rWZFHTNXwE0e80dNceqSrRdzOqA6sJRE5K// z6ys0NAB1kNq6U8FXDlDw+z0LS7fvCajWwLGMustJW90HPoRUSbwd1uDIyOULRUEELcA alId7Ym36Huth05JxAL6sTXRCsrsnXDYtQir9TAthzqykJW9CPfRy6uHKmGuQiygY3tH 3SVmgPiheRAHm6QMcsiSaMG5WfhgsQsRqGZbk/neY4rboBZAYpIJQETCD6/6a+KcNU4C OAICxZmwe21njkSivNt+Gky3xh4ELwT5EMbohcFpeU/pl4zCIUAU3MM+OC9bvgnM0Fzb +qJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=RrptCnW9tRiHiUB1RP/FzSnuf+Kp/mYWJ+RO9N68kcE=; b=j3GFcr5oJ8vV+ALKfuv9bFFLO9zgbA3c/nsO2x1Kx4R7zgvfQIbRPk0v6lziAXYYui /YdxU1oTNw8FRFFY6qV375mhe3QcqgRfPB0MC8Aenm9fShRzUINGEo81Tdbro5sDkqfj I87bzwDssdcKzjKG+ax6IegtBhT29BY/6ivfK+at5wRdTf8QcpkNa1m2Wj5OiHHNQvvF 3OMOFfeVR9JBa19KYu1To3RrPOGB+HC0PxAHANbrE64a6+DpHmx+Uvvv8tDm3iMPFdGA MVP0jbcV8JUH3D7KP8RoaEr1FXARFf1dXLZRF+T5dWV3b8PIdHwEZKReCjpYaDsNB/VD Ayvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si6479877ots.150.2020.04.04.01.44.27; Sat, 04 Apr 2020 01:44:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbgDDImN (ORCPT + 99 others); Sat, 4 Apr 2020 04:42:13 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:41587 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726443AbgDDImF (ORCPT ); Sat, 4 Apr 2020 04:42:05 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jKeN2-0000ua-OT; Sat, 04 Apr 2020 10:41:40 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 6E1511C047B; Sat, 4 Apr 2020 10:41:40 +0200 (CEST) Date: Sat, 04 Apr 2020 08:41:40 -0000 From: "tip-bot2 for Andreas Gerstmayr" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf script report: Fix SEGFAULT when using DWARF mode Cc: Andreas Gerstmayr , Kim Phillips , Adrian Hunter , Alexander Shishkin , Jiri Olsa , Kan Liang , Mark Rutland , Namhyung Kim , Peter Zijlstra , "Steven Rostedt (VMware)" , Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <20200402125417.422232-1-agerstmayr@redhat.com> References: <20200402125417.422232-1-agerstmayr@redhat.com> MIME-Version: 1.0 Message-ID: <158598970009.28353.16717946414374202141.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 1a4025f06059eeaecb2ef24363350ea3431568df Gitweb: https://git.kernel.org/tip/1a4025f06059eeaecb2ef24363350ea3431568df Author: Andreas Gerstmayr AuthorDate: Thu, 02 Apr 2020 14:54:16 +02:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Fri, 03 Apr 2020 09:39:53 -03:00 perf script report: Fix SEGFAULT when using DWARF mode When running perf script report with a Python script and a callgraph in DWARF mode, intr_regs->regs can be 0 and therefore crashing the regs_map function. Added a check for this condition (same check as in builtin-script.c:595). Signed-off-by: Andreas Gerstmayr Tested-by: Kim Phillips Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Kan Liang Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Steven Rostedt (VMware) Link: http://lore.kernel.org/lkml/20200402125417.422232-1-agerstmayr@redhat.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/scripting-engines/trace-event-python.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 8c1b27c..2c372cf 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c @@ -694,6 +694,9 @@ static int regs_map(struct regs_dump *regs, uint64_t mask, char *bf, int size) bf[0] = 0; + if (!regs || !regs->regs) + return 0; + for_each_set_bit(r, (unsigned long *) &mask, sizeof(mask) * 8) { u64 val = regs->regs[i++];