Skip to content

Commit 1a4025f

Browse files
andreasgerstmayracmel
authored andcommitted
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 <agerstmayr@redhat.com> Tested-by: Kim Phillips <kim.phillips@amd.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt (VMware) <rostedt@goodmis.org> Link: http://lore.kernel.org/lkml/20200402125417.422232-1-agerstmayr@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 628d736 commit 1a4025f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎tools/perf/util/scripting-engines/trace-event-python.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,9 @@ static int regs_map(struct regs_dump *regs, uint64_t mask, char *bf, int size)
694694

695695
bf[0] = 0;
696696

697+
if (!regs || !regs->regs)
698+
return 0;
699+
697700
for_each_set_bit(r, (unsigned long *) &mask, sizeof(mask) * 8) {
698701
u64 val = regs->regs[i++];
699702

0 commit comments

Comments
 (0)