Skip to contentSkip to conversation

perf-list: perf list sw segmentation fault fix

PATCH In review Michael Petlan 2 participants 2 messages Dec 2, 2015 – Dec 6, 2015 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf-list: perf list sw segmentation fault fix

The PERF_COUNT_SW_BPF_OUTPUT entry is missing in the event_symbols_sw array. Due to that "perf list sw" segfaults, because a NULL pointer is passed to strlen() function at util/parse-events.c:1895.

After this patch, the syms array is set correctly, so "perf list sw" does not segfault.

Before:

Segmentation fault

After:

List of pre-defined events (to be used in -e):

  alignment-faults                                   [Software event]
  bpf-output                                         [Software event]
  context-switches OR cs                             [Software event]
  cpu-clock                                          [Software event]
  cpu-migrations OR migrations                       [Software event]
  dummy                                              [Software event]
  emulation-faults                                   [Software event]
  major-faults                                       [Software event]
  minor-faults                                       [Software event]
  page-faults OR faults                              [Software event]
  task-clock                                         [Software event]
---
 tools/perf/util/parse-events.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/perf/util/parse-events.c +4 -0
index e48d9da..40ae92a 100644
@@ -124,6 +124,10 @@ struct event_symbol event_symbols_sw[PERF_COUNT_SW_MAX] = {
 		.symbol = "dummy",
 		.alias  = "",
 	},
+	[PERF_COUNT_SW_BPF_OUTPUT] = {
+		.symbol = "bpf-output",
+		.alias  = "",
+	},
 };
 
 #define __PERF_EVENT_FIELD(config, name) \
#1 lore raw

Em Wed, Dec 02, 2015 at 02:52:02PM +0100, Michael Petlan escreveu:

Quoted 6 lines

The PERF_COUNT_SW_BPF_OUTPUT entry is missing in the event_symbols_sw array. Due to that "perf list sw" segfaults, because a NULL pointer is passed to strlen() function at util/parse-events.c:1895.

After this patch, the syms array is set correctly, so "perf list sw" does not segfault.

I had that fixed already, its upstream by now.

Thanks,

- Arnaldo