Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1714555ybb; Thu, 2 Apr 2020 06:07:01 -0700 (PDT) X-Google-Smtp-Source: APiQypIFEO2rtarhWjnULlZxDJs+kMRykSpvm6U5kvARiAW13QZ61UhEZgbS0sOyyfn+yrfKneSW X-Received: by 2002:aca:5712:: with SMTP id l18mr2119900oib.178.1585832821101; Thu, 02 Apr 2020 06:07:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585832821; cv=none; d=google.com; s=arc-20160816; b=uBeG0G9XHeJywCCrbzV3ml/MaLCxLsMXNROm3Chz+N216+zbM4Z2dObakuOPk9ku7M 9qoS18KKJmeaGqzt/OY1D2GL8a30JIyKoQtyY5U0l7Da+KWsZaRd4eM7wtOaxky8/y89 wG79mFTArJIP3RdNI9aBuK6bum1NLoAe3nRto9V4kb6jiTIDD3CQH3xGaYwwwxpbDEKZ Dd7hTCKjHXkDD3P2iOL8HfZdF2j0tzBeZJM9vcnb48/k+z3vETPchXJteaLiC3V59pED DfrHRrdNgGAfQLFGtEcdPutviNy21nSQwQwZJYGh7RV4o78cjxRieKolAktp3WbEqVyL s3/Q== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vZvhHGCmfnLbwTygn83xh2oho2ABzyI8d4jgR5/bYHs=; b=ATN1x0nXwBgW+31FIaMvI5W+DuZVKZTJopFsob+T0IKXfyXroHIjtsCI6YZqcWpvkc kp5EdqP5EYsZPHQouwv3v9Hg4WjfEtFE0pPgLCeGOwpHfhWgv6hIiHdeCeI48NzE79oY /gijC9UJFmKWsLEeIu1YAQORYjQlf4PmToszYPyCKTm/psAr4BE1/ponJaXXhyNoMh1O G+3JA262sacZWA0dKfKWjTT9rRprfIFJSpyjO4Q7Wdg3zMljeTFKU6eAK7a/5MyjI936 C+pxifB1sSdUp0Pa/GqsDXK6MzWb8+QmROeLRZ0FReCoLSs8mQu7cJB4Oq82AUNC8wwy EEWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Vsn9aHMv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e24si2454588otk.203.2020.04.02.06.06.27; Thu, 02 Apr 2020 06:07:01 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Vsn9aHMv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388431AbgDBMy7 (ORCPT + 99 others); Thu, 2 Apr 2020 08:54:59 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:32642 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388332AbgDBMy6 (ORCPT ); Thu, 2 Apr 2020 08:54:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585832097; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vZvhHGCmfnLbwTygn83xh2oho2ABzyI8d4jgR5/bYHs=; b=Vsn9aHMvvjU5KhCbRhtieoQGcIXrFWn2Jp6rZuPMhnYy0G4ji+BnpDnbiweawNNmww1TUD MBIR2lFaEcZot8sx2b68yFGIJRZEqFwSG9ungm7cHUA3a5+1k6Lx7t+oRaLsgpy6swZuH7 7+EPjLUiXEfw0teY1rAe9DBu8iUQr/w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-407-IeVeNxQxPXK74OcVA2DU6w-1; Thu, 02 Apr 2020 08:54:56 -0400 X-MC-Unique: IeVeNxQxPXK74OcVA2DU6w-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A628E13F8; Thu, 2 Apr 2020 12:54:54 +0000 (UTC) Received: from agerstmayr-thinkpad.redhat.com (unknown [10.40.192.105]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC7FD5C1B0; Thu, 2 Apr 2020 12:54:48 +0000 (UTC) From: Andreas Gerstmayr To: linux-perf-users@vger.kernel.org Cc: Andreas Gerstmayr , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , "Steven Rostedt (VMware)" , Kan Liang , linux-kernel@vger.kernel.org Subject: [PATCH] perf script report: fix segfault when using DWARF mode Date: Thu, 2 Apr 2020 14:54:16 +0200 Message-Id: <20200402125417.422232-1-agerstmayr@redhat.com> In-Reply-To: <05e0d633-54b4-fb3b-3d08-8963271017ea@amd.com> References: <05e0d633-54b4-fb3b-3d08-8963271017ea@amd.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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/too= ls/perf/util/scripting-engines/trace-event-python.c index 8c1b27cd8b99..2c372cf5495e 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) =20 bf[0] =3D 0; =20 + if (!regs || !regs->regs) + return 0; + for_each_set_bit(r, (unsigned long *) &mask, sizeof(mask) * 8) { u64 val =3D regs->regs[i++]; =20 --=20 2.25.1