perf-list: perf list sw segmentation fault fix
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
@@ -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) \
Em Wed, Dec 02, 2015 at 02:52:02PM +0100, Michael Petlan escreveu:
Quoted 6 lines
The
PERF_COUNT_SW_BPF_OUTPUTentry is missing in theevent_symbols_swarray. Due to that "perf list sw" segfaults, because a NULL pointer is passed tostrlen()function atutil/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